android - Pixel 2 XL 上的本机异常
问题描述
我在 Pixel 2 XL 上运行我的应用时遇到了一些问题。
昨天,它运行良好,该应用程序按预期在模拟器上运行。
行为
应用程序第一次启动时它可以工作,再次启动它会导致本机代码异常。
我的应用没有原生库
例外
2021-03-23 00:05:17.868 14827-14827/? A/DEBUG: Build fingerprint: 'google/taimen/taimen:11/RP1A.201005.004.A1/6934943:user/release-keys'
2021-03-23 00:05:17.868 14827-14827/? A/DEBUG: Revision: 'rev_10'
2021-03-23 00:05:17.868 14827-14827/? A/DEBUG: ABI: 'arm64'
2021-03-23 00:05:17.869 14827-14827/? A/DEBUG: Timestamp: 2021-03-23 00:05:17+0000
2021-03-23 00:05:17.869 14827-14827/? A/DEBUG: pid: 14708, tid: 14708, name: my_app.debug >>> my.app.package.name.debug <<<
2021-03-23 00:05:17.869 14827-14827/? A/DEBUG: uid: 10364
2021-03-23 00:05:17.869 14827-14827/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
2021-03-23 00:05:17.869 14827-14827/? A/DEBUG: Cause: null pointer dereference
2021-03-23 00:05:17.869 14827-14827/? A/DEBUG: x0 0000000000000000 x1 00000070811181ec x2 7265646f63654400 x3 726f7463656c6553
2021-03-23 00:05:17.869 14827-14827/? A/DEBUG: x4 0000000000000000 x5 0000000000000000 x6 716e7362646b6452 x7 7f7f7f7f7f7f7f7f
2021-03-23 00:05:17.869 14827-14827/? A/DEBUG: x8 0101010101010101 x9 0000007080e75000 x10 00000060000373c8 x11 0000007081118488
2021-03-23 00:05:17.869 14827-14827/? A/DEBUG: x12 00000000ffffffff x13 0000000000000000 x14 4b3d092f234ec266 x15 cae6c696f68e9634
2021-03-23 00:05:17.869 14827-14827/? A/DEBUG: x16 00000070851be0f0 x17 000000736eb69870 x18 000000737463e000 x19 0000000000000003
2021-03-23 00:05:17.869 14827-14827/? A/DEBUG: x20 0000000000000000 x21 000000600001ff40 x22 0000007fdddfe528 x23 00000060000373c8
2021-03-23 00:05:17.869 14827-14827/? A/DEBUG: x24 00000060000373d8 x25 0000000000000000 x26 0000007fdddfe7c0 x27 0000000000000000
2021-03-23 00:05:17.869 14827-14827/? A/DEBUG: x28 00000060000b81a0 x29 0000007fdddfe480
2021-03-23 00:05:17.869 14827-14827/? A/DEBUG: lr 00000070841499dc sp 0000007fdddfe450 pc 00000070841499dc pst 0000000080000000
2021-03-23 00:05:17.870 14827-14827/? A/DEBUG: backtrace:
2021-03-23 00:05:17.870 14827-14827/? A/DEBUG: #00 pc 00000000034529dc /data/app/~~XYsxcfPioD_lXrykYiuRug==/com.google.android.webview-BV9BYYU2jmEepqoY1a5GdA==/base.apk!libmonochrome.so (offset 0x2d3000) (BuildId: 95f822edbc9f6b7eae5123e2b88ce8cf430204b4)
2021-03-23 00:05:18.270 921-921/? E/tombstoned: Tombstone written to: /data/tombstones/tombstone_19
PlayStore 上的当前版本的应用程序也遇到了同样的问题,所以我非常有信心这个问题不是由于我的代码最近的更改造成的。
我发现了什么
我注意到异常提到libmonochrome.so
我读到这可能与 WebView 有关,我的应用程序上确实有一个 WebView,但它是次要活动,并且在应用程序启动时没有启动。
删除此活动没有效果。
如果我清除存储,应用程序开始工作,但是一旦我尝试重新打开它,应用程序就会关闭并立即最小化,它会留在后台并黑屏。
这对我来说没有多大意义,我评论了启动主要活动的代码,所以基本上,我只是在运行启动画面。
我在模拟器上运行项目没有问题,模拟器显示 Splash 活动并在不导致本机异常的情况下执行此操作。
SplashActivity.kt
class SplashActivity : BaseActivity() {
override fun onCreateActivity(savedInstanceState: Bundle?) {
setContentView(R.layout.activity_splash)
}
// commented code...
}
基本活动.kt
abstract class BaseActivity : AppCompatActivity() {
abstract fun onCreateActivity(savedInstanceState: Bundle?)
override fun onCreate(savedInstanceState: Bundle?) {
val extras = intent.getBundleExtra("saved_state")
super.onCreate(savedInstanceState ?: extras)
requestWindowFeature(Window.FEATURE_NO_TITLE)
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN)
onCreateActivity(savedInstanceState ?: extras)
}
// used for night mode transitions
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
PreferenceManager.getDefaultSharedPreferences(this).edit().putInt(UI_MODE_PREF_KEY, newConfig.uiMode).apply()
AppCompatDelegate.setDefaultNightMode(newConfig.uiMode)
transitionRecreate()
}
// used for night mode transitions
protected open fun transitionRecreate() {
val bundle = Bundle()
onSaveInstanceState(bundle)
val intent = Intent(this, javaClass)
intent.putExtra("saved_state", bundle)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
startActivity(intent)
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'com.google.firebase.crashlytics'
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude("META-INF/*.kotlin_module")
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
compileSdkVersion 30
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "my.package"
minSdkVersion 19
targetSdkVersion 30
versionCode 77
versionName "2.3v"
// vectorDrawables.useSupportLibrary = true
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// If set to 'true', enables the instrumentation class to start and stop profiling.
// If set to false (default), profiling occurs the entire time the instrumentation
// class is running.
testHandleProfiling true
// If set to 'true', indicates that the Android system should run the instrumentation
// class as a functional test. The default value is 'false'
testFunctionalTest true
}
testOptions {
unitTests{
returnDefaultValues = true
}
}
signingConfigs {
config {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
storeFile file(properties.getProperty('storeFile'))
keyAlias properties.getProperty('keyAlias')
storePassword properties.getProperty('storePassword')
keyPassword properties.getProperty('keyPassword')
}
}
android.buildFeatures.dataBinding = true
dexOptions {
javaMaxHeapSize '4g'
}
buildTypes {
release {
signingConfig signingConfigs.config
minifyEnabled true
shrinkResources true
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFile "proguard-gson.pro"
proguardFile "proguard-google-play-services.pro"
proguardFile "proguard-support-v7-appcompat.pro"
proguardFile "proguard-joda.pro"
}
debug {
debuggable true
signingConfig signingConfigs.config
applicationIdSuffix ".debug"
firebaseCrashlytics {
// If you don't need crash reporting for your debug build,
// you can speed up your build by disabling mapping file uploading.
mappingFileUploadEnabled false
}
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':MaterialDialog')
// Lottie Animation Library
implementation 'com.airbnb.android:lottie:3.4.4'
/* Multidex */
implementation 'androidx.multidex:multidex:2.0.1'
/* FACEBOOK */
implementation 'com.facebook.android:facebook-android-sdk:8.0.0'
implementation 'com.github.wrdlbrnft:sorted-list-adapter:0.2.0.1'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'com.scottyab:aescrypt:0.0.1'
//implementation 'com.github.traex.rippleeffect:library:1.3'
implementation 'com.squareup.picasso:picasso:2.71828'
//implementation 'com.miguelcatalan:materialsearchview:1.4.0'
implementation 'im.dacer:AndroidCharts:1.0.4'
implementation 'com.github.greenfrvr:rubber-loader:1.1.2@aar'
/* SUPPORT LIBRARY */
implementation "com.google.android.play:core:1.10.0"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.preference:preference-ktx:1.1.1"
implementation "androidx.annotation:annotation:1.1.0"
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.fragment:fragment-ktx:1.3.1"
/* FIREBASE */
implementation platform('com.google.firebase:firebase-bom:26.0.0')
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-core:18.0.2'
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.firebaseui:firebase-ui-auth:7.1.0'
implementation 'com.firebaseui:firebase-ui-database:7.1.0'
implementation 'com.firebaseui:firebase-ui-auth:7.1.0'
implementation 'com.google.firebase:firebase-messaging-ktx:21.0.1'
implementation "com.google.firebase:firebase-auth-ktx:20.0.3"
implementation "com.google.firebase:firebase-storage-ktx:19.2.1"
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
implementation "com.google.firebase:firebase-ads:19.8.0"
implementation "com.google.firebase:firebase-config-ktx:20.0.4"
implementation "com.google.firebase:firebase-perf-ktx:19.1.1"
implementation "com.google.firebase:firebase-database-ktx:19.7.0"
implementation "com.google.firebase:firebase-appindexing:19.2.0"
implementation 'com.google.firebase:firebase-firestore-ktx:22.1.1'
implementation 'com.google.firebase:firebase-config-ktx:20.0.4'
implementation 'com.google.firebase:firebase-functions-ktx:19.2.0'
implementation 'com.google.guava:guava:29.0-jre'
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'com.chaos.view:pinview:1.3.2'
//For playing .gif images
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.21'
// Room components
implementation "androidx.room:room-runtime:2.2.6"
kapt "androidx.room:room-compiler:2.2.6"
androidTestImplementation "androidx.room:room-testing:2.2.6"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-common-java8:2.3.0"
// Lifecycle components
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
// annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.1.0"
/* Retrofit */
// Max version to support APIS below 21
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:retrofit-converters:2.6.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.1'
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
implementation 'joda-time:joda-time:2.10.6'
debugImplementation 'com.sothree.slidinguppanel:library:3.4.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.31"
implementation 'com.android.billingclient:billing:3.0.3'
implementation 'com.android.billingclient:billing-ktx:3.0.3'
kapt "com.android.databinding:compiler:3.3.2"
//shimmer
implementation 'com.facebook.shimmer:shimmer:0.5.0'
// Kotlin + coroutines
implementation "androidx.work:work-runtime-ktx:2.5.0"
implementation "androidx.room:room-ktx:2.2.6"
implementation "com.theartofdev.edmodo:android-image-cropper:2.8.0"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.2.1'
implementation "org.jetbrains.kotlin:kotlin-reflect:1.4.31"
implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
implementation 'com.akexorcist:RoundCornerProgressBar:2.0.3'
implementation 'com.google.android.ads.consent:consent-library:1.0.8'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'com.google.android:flexbox:2.0.1'
implementation 'nl.bryanderidder:themed-toggle-button-group:1.1.0'
implementation 'com.github.strooooke:appbarsyncedfab:v0.5'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.4'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.4'
implementation 'jp.wasabeef:picasso-transformations:2.2.1'
// Unit Testing .\
implementation 'com.google.dagger:dagger:2.31.2'
kapt 'com.google.dagger:dagger-compiler:2.31.2'
implementation 'com.google.dagger:dagger-android:2.29.1'
kapt 'com.google.dagger:dagger-android-processor:2.29.1'
kaptAndroidTest 'com.google.dagger:dagger-compiler:2.31.2'
debugImplementation 'androidx.fragment:fragment-ktx:1.3.1'
debugImplementation ('androidx.fragment:fragment-testing:1.3.0-alpha08', {
exclude group: 'androidx.test', module: 'core'
})
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:core:1.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'org.mockito:mockito-core:3.7.7'
androidTestImplementation 'org.mockito:mockito-android:3.5.11'
androidTestImplementation "androidx.navigation:navigation-testing:2.3.4"
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
androidTestImplementation "androidx.work:work-testing:2.5.0"
}
kapt {
generateStubs = true
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android-extensions'
repositories {
mavenCentral()
}
更新
我可能会有所进展。
所以我克隆了我的项目并开始删除几乎所有内容,我只用Application
类和SplashActivity
还是同样的错误,所以我开始删除 Application 类上的东西
当我删除这一行
MobileAds.initialize(this)
答对了!有效。
删除此行解决了问题,我试图了解为什么会发生这种情况。
更新 2
看起来谷歌正在尝试解决这个问题,它已被多家新闻媒体报道
解决方案
我有同样的问题,我找到了下一个“临时”解决方案,从设备中卸载 WEBVIEW 更新。
网页浏览:https : //play.google.com/store/apps/details? id=com.google.android.webview
它对我有用。
更新
Google 昨天(3 月 22 日)发布了 WEBVIEW 和 GOOGLE CHROME 应用程序的更新,下载该更新即可解决问题。
推荐阅读
- ruby-on-rails - 尽管 expires_in 24.hours,Rails 缓存值丢失/为零
- java - Sharepoint 使用 JAVA 批量上传
- csv - 当 multiLine 设置为 true 时 spark.sql.files.maxPartitionBytes 不起作用
- automation - Testcafe 自定义报告器不会从 this.formatError 返回
- android - For循环运行两倍的结果?
- typescript - 无法降级到 Typescript 版本 3.4.3
- node.js - Node.js 无法向 k8s api 服务器发出请求
- java - Android alarmManager.setAlarmClock 崩溃 Android 7
- php - jwt-auth 未安装 laravel (6.0.3)
- osgi - AEM 中的服务真的是单例的吗?