Я перенес свое приложение на androidx, следуя шагам документации. Я не изменил код своего приложения, только импорт и классы, необходимые для миграции. Консоль воспроизведения показывает следующую ошибку:
java.lang.RuntimeException:
at android.app.ActivityThread.handleReceiver (ActivityThread.java:3567)
at android.app.ActivityThread.access$1300 (ActivityThread.java:236)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1795)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7032)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:965)
Caused by: java.lang.ClassNotFoundException:
at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateReceiver (AppComponentFactory.java:84)
at androidx.core.app.CoreComponentFactory.instantiateReceiver (CoreComponentFactory.java)
at android.app.ActivityThread.handleReceiver (ActivityThread.java:3560)
at android.app.ActivityThread.access$1300 (ActivityThread.java:236)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1795)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7032)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:965)
Эта ошибка возникает на устройствах Android 9. Перед обновлением показывалась какая-то ошибка.
Я проверил код, аннулировал кеши и перезапустил, отключил Instant Run и установил последние обновления Android, но, к сожалению, ни эмулятор Android, ни физические устройства Android 8 и 9 не показывают ошибок, у меня есть только информация, предоставленная игровой консолью и ошибка остается.
Это мой build.grade
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "es.mtoh.recetasmonsieurcuisine"
minSdkVersion 16
targetSdkVersion 28
versionCode 4
versionName '1.0.4'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// useProguard false // <-- disable proguard
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.browser:browser:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha07'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.fragment:fragment:1.2.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta01'
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'androidx.annotation:annotation:1.1.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'com.google.android.gms:play-services-ads:18.0.0'
implementation 'androidx.drawerlayout:drawerlayout:1.0.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.core:core:1.0.2'
Любое предложение?
Я думаю о возврате миграции.
У меня такая же проблема. Если вы используете AdMob, ознакомьтесь с их обновленными инструкциями по внедрению: https://developers.google.com/admob/android/quick-start#example_app-level_buildgradle_excerpt
Вы должны добавить следующие две строки в свой build.gradle при использовании Admob 18.0.0 с AndroidX:
com.google.android.gms:play-services-measurement:17.0.0
com.google.android.gms:play-services-measurement-sdk:17.0.0