Gradle Build Error

Hi Admin,

Im using Fire 9.0.97.2071. Im facing a problem of : error AP1: Error while running Android tool: dx.bat when I added more gradle into the build script. Below is the gradle build script example. The error will disappear when I either remove “support design sdk” or remove “any of the three firebase sdk” or “remove facebook sdk”. So Im thinking it might be the caused of adding too much gradles? Kindly advise how to solve the problem.

dependencies {
//compile 'com.google.android.gms:play-services:+'
//compile 'com.google.android.gms:play-services-base:+'    
//compile 'com.google.android.gms:play-services-maps:+'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'
compile 'com.google.firebase:firebase-storage:10.2.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'

}

Here I attach the project file if you would like to see the problem.
org.me.androidapplication2.zip (2.4 MB)

Thank You.

Best Regards,
tylim

Hi,

my apologies for that. i’ll have a look at the problem tomorrow morning (unfortunately i don’t have the necessary stuff to reproduce the issue, namely the Android SDK, installed at the computer i’m at right now).

—marc

Thanks Marc. I will be waiting for that. :slight_smile:

Best Regards,
tylim

The problem s that there’s too many classes forma single archive — a Java limitation. Unfortunately the error message

                           trouble writing output: Too many field references: 73879; max is 65536.

gets lost in all the stuff dx.bat emits. To work around this, set Multi-Dex to True/Yes; your project builds fine for me when i do.

Ill see if we can expose tis error better.

yours,
marc

Hi,

Thanks for your solution. However, I cant find out where to set the Multi-Dex in Fire. May I know where do you set the parameter exactly?

Thank You.

Best Regards,
tylim

1 Like

Here:

1 Like

Weird that why I didnt have this parameter in my settings?

Thanks.

what version are you using?

Tried these both version also dont have.

Fire 9.0.97.2071
Fire 9.1.100.2113

Thanks.

Hmm. that cannot be :wink:

oh:

				<key>AndroidPackMultidex</key>
				<dict>
					<key>Type</key>
					<string>Boolean</string>
					<key>Default</key>
					<string>False</string>
					<key>DisplayName</key>
					<string>Android Multi-Dex</string>
					<key>Conditions</key>
					<array>
						<string>AndroidDexMode != Incremental</string>
					</array>
				</dict>

Multi-Dex doesn’t work with Incremental. Select None or Pre-Dex as Android Dex Mode, and the option should show.

Yeah. Problem solved. Thank you so much! XD

Best Regards,
Thol Yong

1 Like

Hi Marc,

I faced another problem. After I have set Multi-Dex to Yes. It did compile successfully but when I deploy and debug in a real android device, I received this error? How do I solve this problem?

Thank You.

Best Regards,
Thol

Hm, anything more in the build/deploy log?

I didnt see other messages. The problem can be reproduced when deploying/debugging the project (uploaded previously) to real device after setting the enable Multi-Dex to yes.

Thank You.

Best Regards
Thol

The Build Log should have the full deployment log (the messagebox seems but of at 69%).