无法从基本应用程序和应用程序崩溃启动动态模块启动活动

问题描述 投票:1回答:1

我正在使用应用程序包 - 我的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启动了应用程序,将deploy选项设置为“Apk from app bundle”

但是,当我单击按钮安装模块时,应用程序崩溃了。

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)

那么如何解决这个问题呢?任何建议表示赞赏。

谢谢

android android-app-bundle
1个回答
1
投票

它对我来说从未在Android Studio中运行过。即使我在运行配置中使用了来自App Bundle的APK。我也尝试使用bundletool。当我使用这两个选项时,我遇到了同样的崩溃。我认为,由于App Bundle处于测试阶段,测试工具仍然存在问题。

但它适用于游戏机 - 内部测试轨道。因此,我认为目前测试应用程序包的最佳方法是在播放控制台而不是android studio中使用内部测试轨道。

通常我首先使用默认APK测试应用程序以检查是否存在运行时问题,如果没有问题,则将aab上传到播放控制台 - 内部测试轨道。

© www.soinside.com 2019 - 2024. All rights reserved.