Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bundletool build-apks has no dex files #38

Closed
junocc opened this issue Nov 29, 2018 · 8 comments
Closed

bundletool build-apks has no dex files #38

junocc opened this issue Nov 29, 2018 · 8 comments

Comments

@junocc
Copy link

junocc commented Nov 29, 2018

Describe the bug
When I used the bundletool build-apks
show the next error.
I need to use a custom Application. Any idea to fix it?

[BT:0.7.1] Error: Module 'base' has no dex files but the attribute 'hasCode' is not set to false in the AndroidManifest.xml.
com.android.tools.build.bundletool.exceptions.ValidationException: Module 'base' has no dex files but the attribute 'hasCode' is not set to false in the AndroidManifest.xml.
at com.android.tools.build.bundletool.exceptions.ValidationException$Builder.build(ValidationException.java:49)
at com.android.tools.build.bundletool.exceptions.ValidationException$Builder.build(ValidationException.java:41)
at com.android.tools.build.bundletool.validation.DexFilesValidator.validateHasCode(DexFilesValidator.java:86)
at com.android.tools.build.bundletool.validation.DexFilesValidator.validateModule(DexFilesValidator.java:58)
at com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundleModulesUsingSubValidator(ValidatorRunner.java:78)
at com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundleUsingSubValidator(ValidatorRunner.java:69)
at com.android.tools.build.bundletool.validation.ValidatorRunner.lambda$validateBundle$3(ValidatorRunner.java:58)
at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:406)
at com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundle(ValidatorRunner.java:58)
at com.android.tools.build.bundletool.validation.AppBundleValidator.validate(AppBundleValidator.java:73)
at com.android.tools.build.bundletool.commands.BuildApksManager.execute(BuildApksManager.java:103)
at com.android.tools.build.bundletool.io.TempFiles.withTempDirectoryReturning(TempFiles.java:52)
at com.android.tools.build.bundletool.commands.BuildApksCommand.execute(BuildApksCommand.java:399)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:77)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:47)

Bundletool version(s) affected
Version: [e.g. 0.7.1]

To Reproduce
Steps to reproduce the behavior.
bundletool build-apks --bundle=/xx/xx --output=/xx/xx --ks=key.keystore --ks-pass=pass:password--ks-key-alias=xxx --key-pass=pass:password

@plecesne
Copy link
Contributor

plecesne commented Nov 29, 2018

The base module in your Android App Bundle does not have a dex file. Apps that don't have dex files need to have the attribute android:hasCode=false set in the AndroidManifest.xml

See https://developer.android.com/guide/topics/manifest/application-element

@junocc
Copy link
Author

junocc commented Nov 29, 2018

The base module in your Android App Bundle does not have a dex file. Apps that don't have dex files need to have the attribute android:hasCode=false set in the AndroidManifest.xml

See https://developer.android.com/guide/topics/manifest/application-element

You right, but my base app generate dex file when I add the attribute android:hasCode=false in the AndroidManifest.xml.
My app can't find custom Application
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xxxx" on path: DexPathList[[],nativeLibraryDirectories=[/data/app/xxx-56AGT5u1xEKyRT1ZB5-

@plecesne
Copy link
Contributor

Is there a dex file in your Bundle? You can look by unzipping it and searching in the base/dex directory.

@plecesne
Copy link
Contributor

plecesne commented Dec 3, 2018

Do you use dexguard? Somebody on stackoverflow mentioned that they had the same issue as you and updating to the latest version of dexguard fixed it.

@junocc
Copy link
Author

junocc commented Dec 3, 2018

Do you use dexguard? Somebody on stackoverflow mentioned that they had the same issue as you and updating to the latest version of dexguard fixed it.

Yes, I use Dexguard. You right! Ty

@junocc junocc closed this as completed Dec 3, 2018
@arpitagarwal1301
Copy link

Found the issue after 2 days of research :
If this happening only in the release then it is possible proguard issue .
Proguard removes the files from the dynamic module if it considers them not useful .
So , you have to modify the proguard keep rules .
-keep class whateverpackagename.** { *; }

@Jitendra194
Copy link

Jitendra194 commented May 31, 2020

Found the issue after 2 days of research :
If this happening only in the release then it is possible proguard issue .
Proguard removes the files from the dynamic module if it considers them not useful .
So , you have to modify the proguard keep rules .
-keep class whateverpackagename.** { *; }

I've been getting the same issue where it says
Error: Module 'module1' has no dex files but the attribute 'hasCode' is not set to false in the AndroidManifest.xml.
I added -keep class whateverpackagename.* { *; } in the proguard rules but the issue still persists.
I'd appreciate any help regarding this.

@plecesne
Copy link
Contributor

plecesne commented Jun 1, 2020

This is not a help forum but an issue tracker. Try stackoverflow or other similar platforms.

Sorry and thanks for your understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants