Я использую комплект приложений - модули динамических функций для моего приложения для Android.Я следовал за документацией и выполнил все необходимые шаги,
(1) Used PlayCore Library - version 1.3.7
(2) Used the SplitCompat Library in my Application class (attachBaseContext)
(3) Used the SplitCompat.install(context) in attachBaseContext() of the new modules launching actvity
(4) Implemented and initiated the SplitInstallManager instance and handled the error codes and status updates.
(5) Double checked the build.gradle and manifest files and everything looks perfect.
Я запустил приложение из Android Studio, установив опцию развертывания на «Apk из комплекта приложения»
Но когда я нажимаю кнопку, чтобы установить модуль, приложение вылетает.
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.something.myapp/com.something.myapp.sample_module.activity.SampleActivity}: java.lang.ClassNotFoundException: Didn't find class "com.something.myapp.sample_module.activity.SampleActivity" on path: DexPathList[[zip file "/data/app/com.something.myapp-OYWwJYvG4hSEq9ul1Y6rHA==/base.apk", zip file "/data/app/com.something.myapp-OYWwJYvG4hSEq9ul1Y6rHA==/split_config.arm64_v8a.apk", zip file "/data/app/com.something.myapp-OYWwJYvG4hSEq9ul1Y6rHA==/split_config.en.apk", zip file "/data/app/com.something.myapp-OYWwJYvG4hSEq9ul1Y6rHA==/split_config.si.apk", zip file "/data/app/com.something.myapp-OYWwJYvG4hSEq9ul1Y6rHA==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/com.something.myapp-OYWwJYvG4hSEq9ul1Y6rHA==/lib/arm64, /data/app/com.something.myapp-OYWwJYvG4hSEq9ul1Y6rHA==/base.apk!/lib/arm64-v8a, /data/app/com.something.myapp-OYWwJYvG4hSEq9ul1Y6rHA==/split_config.arm64_v8a.apk!/lib/arm64-v8a, /data/app/com.something.myapp-OYWwJYvG4hSEq9ul1Y6rHA==/split_config.en.apk!/lib/arm64-v8a, /data/app/com.something.myapp-OYWwJYvG4hSEq9ul1Y6rHA==/split_config.si.apk!/lib/arm64-v8a, /data/app/com.something.myapp-OYWwJYvG4hSEq9ul1Y6rHA==/split_config.xxhdpi.apk!/lib/arm64-v8a, /system/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2881)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Оно говорит Невозможно создать экземпляр активности .Это приложение использует функцию MultiDex, но я думаю, что это не повлияет на комплект приложений - динамические модули.
Когда я отлаживаю приложение, оно переходит в состояние SplitInstallSessionStatus.INSTALLED и затем запускает активность загруженного приложения.модуль.Затем происходит сбой.
ОБНОВЛЕНИЕ: Это AndroidManifest в динамическом модуле
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
package="com.something.myapp.sample_module">
<dist:module
dist:instant="false"
dist:onDemand="true"
dist:title="@string/module_sample">
<dist:fusing dist:include="true" />
</dist:module>
<application android:allowBackup="true">
<activity android:name="com.something.myapp.sample_module.activity.SampleActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
</application>
</manifest>
Это еще один журнал для SplitInstallService:
SplitInstallService : startInstall([sample_module],[])
SplitInstallService : Initiate binding to the service.
com.google.android.finsky.splitinstallservice.du.a(10): Connecting InstallListener to SplitInstallService broadcaster...
SplitInstallService : ServiceConnectionImpl.onServiceConnected(ComponentInfo{com.android.vending/com.google.android.finsky.splitinstallservice.SplitInstallService})
SplitInstallService : linkToDeath
SplitInstallService : Unbind from service.
SplitInstallService : onStartInstall(0)
Итак, как решить эту проблему?Любое предложение приветствуется.
Спасибо