Fixed
Status Update
Comments
xa...@google.com <xa...@google.com> #2
Adding "api 'com.android.support:multidex:1.0.2'" to the application module fixes the issue. But adding "implementation 'com.android.support:multidex:1.0.2'" doesn't.
an...@gmail.com <an...@gmail.com> #3
Can you please share your build.gradle files (for application and android library), as I am unable to reproduce?
From the screenshot, classes8.dex contains only references to the MultiDexApplication, it does not contain definitions of the class. If you execute `dexdump <path_to_apk>` are you able to see the definition of MultiDexApplication?
From the screenshot, classes8.dex contains only references to the MultiDexApplication, it does not contain definitions of the class. If you execute `dexdump <path_to_apk>` are you able to see the definition of MultiDexApplication?
ph...@sprylab.com <ph...@sprylab.com> #4
See attachments for more info.
uc...@google.com <uc...@google.com>
xa...@google.com <xa...@google.com> #5
The difference when building from Studio is that we take into consideration the API of the device you are deploying to, so we might change legacy multidex build to a native multidex one. It looks like the device you are deploying to has API 25, so that is why APK differs when building from the command line and when building from the IDE. In legacy multidex we have requirements due to DalvikVM which classes are in the main dex, and that's why MultiDexApplication is in the classes.dex. However, for native multidex, ART is able to load classes from any classes<N>.dex file. So it is strange that the runtime is unable to find MultiDexApplication, when it's clearly in classes13.dex.
What is the device that you are trying to deploy the app to? From the screenshots it looks like it's a Chromebook?
What is the device that you are trying to deploy the app to? From the screenshots it looks like it's a Chromebook?
Description
Android Plugin Version: 3.0.0-beta2
Module Compile Sdk Version: 26
Module Build Tools Version: 26.0.1
Android SDK Tools version: 26.0.2
Steps to reproduce:
1. Create an Android library module that uses RenderScript via the following configuration in build.gradle:
android {
...
defaultConfig {
...
renderscriptTargetApi 20
renderscriptSupportModeEnabled true
}
}
And has the following class:
public class RenderscriptStuff {
public static RenderScript getRS(Context context) {
return RenderScript.create(context);
}
}
2. Create an Android app module that contains the following class in androidTest directory:
@RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest {
@Test public void canGetRS() {
Context appContext = InstrumentationRegistry.getTargetContext();
assertNotNull(RenderscriptStuff.getRS(appContext));
}
}
3. Run the following command from the command line:
./gradlew compileDebugAndroidTestSources
Expected behavior:
- Compilation succeeds
Actual behavior:
- Compilation fails with the following error:
ExampleInstrumentedTest.java:28: error: cannot access RenderScript
assertNotNull(RenderscriptStuff.getRS(appContext));
^
class file for android.support.v8.renderscript.RenderScript not found
1 error
Please find a project that reproduces the issue in the attachments.