Fixed
Status Update
Comments
xa...@google.com <xa...@google.com>
to...@gmail.com <to...@gmail.com> #2
[Comment deleted]
je...@google.com <je...@google.com> #3
[Comment deleted]
to...@gmail.com <to...@gmail.com> #4
Also of note is the adb error when trying to install bad APK: INSTALL_FAILED_DEXOPT
ds...@gmail.com <ds...@gmail.com> #5
load dex files over 5Gb. -> load dex files over 5Mb.
je...@google.com <je...@google.com> #6
Same here! Looking forward to a solution :)
Android Studio version: 0.8.12
buildToolsVersion 21.0.1
Gradle 1.11
Android Studio version: 0.8.12
buildToolsVersion 21.0.1
Gradle 1.11
ds...@gmail.com <ds...@gmail.com> #7
There is already an option in dx allowing to force generation of smaller dex files:
--set-max-idx-number=<value>
Unfortunately changing the default is not a solution since the linearAlloc limit can be reached at very different levels depending on the classes hierarchy and other criteria.
In addition for most applications, moving to multidex will only help to workaround the linearalloc limit for the installation. But the application will still crash against the same limit at execution. The only working use case where I know multidex can help with linearalloc is when the apk does not contains one application but distinct pieces running in separate process.
--set-max-idx-number=<value>
Unfortunately changing the default is not a solution since the linearAlloc limit can be reached at very different levels depending on the classes hierarchy and other criteria.
In addition for most applications, moving to multidex will only help to workaround the linearalloc limit for the installation. But the application will still crash against the same limit at execution. The only working use case where I know multidex can help with linearalloc is when the apk does not contains one application but distinct pieces running in separate process.
je...@google.com <je...@google.com> #8
Thanks for your quick response.
It's nice to know about that command line option. I do not see it in the output of 'dx --help', might be good to add that.
I'm not very familiar with the 'linearAlloc limit' issue outside of the context of the dexopt step. My sample app is able to run once the lower idx value is set, although I do not actually call into any of the library code that is bundled with the app. I assume it's undefined when/if the 'linearAlloc limit' will be hit in a large application on gb.
I'm a bit confused as to the platform compatibility of multidex given the 'linearAlloc limit' bug. What specific versions of Android are supported? The multidex code implies back to v4 (https://android.googlesource.com/platform/frameworks/multidex/+/master/library/src/android/support/multidex/MultiDex.java ) but it would seem that ICS is the earliest supported platform. Is this correct?
It's nice to know about that command line option. I do not see it in the output of 'dx --help', might be good to add that.
I'm not very familiar with the 'linearAlloc limit' issue outside of the context of the dexopt step. My sample app is able to run once the lower idx value is set, although I do not actually call into any of the library code that is bundled with the app. I assume it's undefined when/if the 'linearAlloc limit' will be hit in a large application on gb.
I'm a bit confused as to the platform compatibility of multidex given the 'linearAlloc limit' bug. What specific versions of Android are supported? The multidex code implies back to v4 (
ds...@gmail.com <ds...@gmail.com> #9
The option is not documented in --help because it was designed for testing and we're not capable of documenting a reliable way to use it as a workaround of the linearalloc limit.
The linearalloc limit is reached when loading classes. At install time dexopt is loading all classes contained in the dex so it's facing the limit immediately. At execution the limit may be reached after some delay dependending of the usage you have of the packaged classes. If you face it at install time but not at execution, this means you never trigger the loading of some classes. In a real application those never loaded classes should have been shrinked away manually or by Proguard. The exception is when there are different groups of classes in the dex files used in separate process.
About multidex library supported versions I've merged recently a change to try to be clearerhttps://android-review.googlesource.com/#/c/108023/
The summary is that the library should work down to API 4 (Donut), but below ICS applications will probably be hit by the linearalloc limit
The linearalloc limit is reached when loading classes. At install time dexopt is loading all classes contained in the dex so it's facing the limit immediately. At execution the limit may be reached after some delay dependending of the usage you have of the packaged classes. If you face it at install time but not at execution, this means you never trigger the loading of some classes. In a real application those never loaded classes should have been shrinked away manually or by Proguard. The exception is when there are different groups of classes in the dex files used in separate process.
About multidex library supported versions I've merged recently a change to try to be clearer
The summary is that the library should work down to API 4 (Donut), but below ICS applications will probably be hit by the linearalloc limit
je...@google.com <je...@google.com> #10
for Android studio use:
dexOptions {
additionalParameters = ['--multi-dex', '--set-max-idx-number=40000']
}
dexOptions {
additionalParameters = ['--multi-dex', '--set-max-idx-number=40000']
}
al...@google.com <al...@google.com>
je...@google.com <je...@google.com> #11
I still have this issue and it's driving me nuts
al...@google.com <al...@google.com>
to...@gmail.com <to...@gmail.com> #14
I tried to use it and at first look, it looks like everything works as expected. Thanks!
to...@gmail.com <to...@gmail.com> #15
The big issue is, that the current AGP 7.4.0 is broken. I tried to use this API and it is still broken in 7.4.0, it is probably really in AGP 8 :-(
Description
For single file artifact like bundle
variant.artifacts.use(updateBundleArtifact)
.wiredWithFiles(
UpdateArtifactTask::initialArtifact,
UpdateArtifactTask::updatedArtifact
)
.toTransform(ArtifactType.BUNDLE)
it set this value
originalArtifact: app\build\outputs\bundle\debug\signDebugBundle\app-debug.aab
updatedArtifact: app\build\outputs\bundle\debug\debugUpdateArtifact\out
There are more weird things:
- why there is this "sign" prefix for the original file? It should be just "debugBundle"
- why output file is "out". and not app-debug.aab
- According to Xavier Ducrohet only the final artifact should be inside of outputs folder
- Then I don't see the reason for changing the name of the folder debugBundle to debugUpdateArtifact (if only final artifact should be there), it will really help with old plugins that will not use new variant API and will depend on the hardcoded path.
- I would really appreciate if there will be also the possibility to change the name of the output artifact during this transform, not the only file content.
And when I use this
variant.artifacts.use(updateApkArtifact)
.wiredWithDirectories(
UpdateDirArtifactTask::inputDir,
UpdateDirArtifactTask::outputDir
)
.toTransform(ArtifactType.APK)
It set this
Input folder: app\build\outputs\apk\debug
Output folder: app\build\intermediates\apk\debug\debugUpdateAPKArtifact
- output folder is inside of intermediates instead of input one
- also here I would expect that the output folder will be the same as the normal output folder for APK without transformation (for last one transformation in the chain). Why another level of the hierarchy?
There is one more unexpected thing that
val artifacts = builtArtifactsLoader.get().load(inputDir.get())
artifacts?.elements?.forEach {
it.outputFile is just String. I would expect File there.
Build: AI-202.7660.26.42.6987402, 202011210045,
AI-202.7660.26.42.6987402, JRE 11.0.8+10-b944.6842174x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 2560x1440, 2560x1440
AS: 4.2 Beta 1; Kotlin plugin: 1.4.20-release-Studio4.2-1; Android Gradle Plugin: 4.2.0-beta01; Gradle: 6.7; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)
IMPORTANT: Please read