小编Tor*_*mod的帖子

Android磨损项目有3种风格,3种buildTypes和2种applicationIdSuffixes

在尝试将wearApp flavor和buildTypes与applicationIdSuffixes结合后构建我的项目时,我收到以下错误消息:

Error:Execution failed for task ':app:handleFirstCustomerTestMicroApk'.
> The main and the micro apps do not have the same package name.
Run Code Online (Sandbox Code Playgroud)

从我的app/build.gradle:

buildTypes {
    debug {
        applicationIdSuffix '.debug'
        debuggable true
        embedMicroApp = true
    }
    customerTest {
        applicationIdSuffix '.customertest'
        debuggable true
        embedMicroApp = true
    }
    release {
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        minifyEnabled true
        embedMicroApp = true
    }
}

productFlavors {
    first {
        applicationId 'com.my.app.first'
    }
    second {
        applicationId 'com.my.app.second'
    }
    third {
        applicationId 'com.my.app.third'
    }
}

dependencies {
    firstWearApp project(path: ':wear', configuration: …
Run Code Online (Sandbox Code Playgroud)

android build.gradle android-productflavors android-build-type wear-os

30
推荐指数
1
解决办法
1408
查看次数

无法实例化活动...未在路径上找到类WelcomeActivity:DexPathList(使用即时运行)

我已经在我的项目中苦苦挣扎了几天,突然从一个构建/部署到另一个我开始得到以下异常.没有更新或更改,我只是想在它发生时在不同的设备上运行应用程序(就像其他任何一天真的一样).

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.my.app.flavor.debug/com.my.app.ui.activity.WelcomeActivity}: java.lang.ClassNotFoundException: Didn't find class "com.my.app.flavor.ui.activity.WelcomeActivity" on path: DexPathList[[zip file "/data/app/com.my.app.flavor.debug-2/base.apk"],nativeLibraryDirectories=[/data/app/**com.my.app.flavor.**debug-2/lib/x86, /data/app/com.my.app.flavor.debug-2/base.apk!/lib/x86, /vendor/lib, /system/lib]]
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                  at android.app.ActivityThread.-wrap11(ActivityThread.java)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                  at android.os.Handler.dispatchMessage(Handler.java:102)
                  at android.os.Looper.loop(Looper.java:148)
                  at android.app.ActivityThread.main(ActivityThread.java:5417)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
               Caused by: java.lang.ClassNotFoundException: Didn't find class "com.my.app.ui.activity.WelcomeActivity" on path: DexPathList[[zip file "/data/app/com.my.app.flavor.debug-2/base.apk"],nativeLibraryDirectories=[/data/app/com.my.app.flavor.debug-2/lib/x86, /data/app/com.my.app.flavor.debug-2/base.apk!/lib/x86, /vendor/lib, /system/lib]]
                  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                  at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                  at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                  at android.app.Instrumentation.newActivity(Instrumentation.java:1067)
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                  at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                  at android.os.Handler.dispatchMessage(Handler.java:102) 
                  at android.os.Looper.loop(Looper.java:148) 
                  at android.app.ActivityThread.main(ActivityThread.java:5417) 
                  at java.lang.reflect.Method.invoke(Native …
Run Code Online (Sandbox Code Playgroud)

android classnotfoundexception dex android-studio android-instant-run

5
推荐指数
1
解决办法
2484
查看次数