cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

This product reached the end of support date on March 31, 2021.

Android - Auto-Instrumentation Cannot Handle - Too Many Fields Exception

kanishk_verma
Newcomer

Hi,

I'd like to get your help in resolving the following error message after trying to build a multi-dexed Android App Project integrated with DynaTrace AppMon API.

/Users/dev/AndroidStudioProjects/Demo-Android/app/build/outputs/apk/app-dev-release/classes.dex ... #methods: 52303 

2018-01-11 13:44:48.657 INFO: APKit-AdkInstrumentor(1): /Users/dev/AndroidStudioProjects/Demo-Android/app/build/outputs/apk/app-dev-release/classes2.dex ... #methods: 52097

2018-01-11 13:44:54.544 INFO: APKit-AdkInstrumentor(1): Handling primary DEX file

2018-01-11 13:44:54.558 INFO: APKit-AdkInstrumentor(1): Original DEX #methods=52303 #fields=65200

2018-01-11 13:44:56.267 SEVERE: caa-jg(1): 813 + 65200 = 66013 fields

2018-01-11 13:44:56.267 SEVERE: APKit-AdkInstrumentor(1): Auto-Instrumentation cannot handle this application - too many fieldsThrowable occurred: com.dynatrace.android.instrumentation.diag.a: Auto-Instrumentation cannot handle this application - too many fields
at com.dynatrace.android.instrumentation.AdkInstrumentor.a(SourceFile:77
at com.dynatrace.android.instrumentation.AdkInstrumentor.g(SourceFile:79
at com.dynatrace.android.instrumentation.AdkInstrumentor.h(SourceFile:84
at com.dynatrace.android.instrumentation.AdkInstrumentor.a(SourceFile:19
at com.dynatrace.android.instrumentation.AdkInstrumentor.main(SourceFile:1177) Instrumentation failed

Thanks!

5 REPLIES 5

kanishk_verma
Newcomer

......anyone?

andrew_klare
Newcomer

I switched to a release build variant in Android Studio and it got me past this error. I am asking about the error in debug mode.

andrew_klare
Newcomer

Sounds like this error may be caused by the number or size of the DEX files created during the build and/or instrumentation. I was able to get some help from dynatrace on this and we added a DTXPrimaryDexLimit and DTXSecondaryDexLimit to the agentProperties config in Android app build.gradle file. Your limits may need to be different but the below limits ended up working in my case. I think if debugging is enabled ('DTXLogLevel': 'debug') you can see the method and field count which may help you set your limits. The limits we picked seem to be just under the number of methods for primary, and fields for secondary, that are shown in the debugger but that might be a coincidence.

agentProperties 'DTXLogLevel': 'debug', 'DTXPrimaryDexLimit': '500', 'DTXSecondaryDexLimit': '64000'

Some of the debug log with possible hint to limit values:

2018-06-20 11:07:27.031 FINE: APKit-v(1): 1751 + 589 = 2340 methods

2018-06-20 11:07:27.031 SEVERE: APKit-v(1): 916 + 65210 = 66126 fields

Maybe too late for you @TestDev but maybe it can help someone else with this issue.

nicholas_mcwher
Dynatracer
Dynatracer

Hello, TestDev.

I'm not sure if you are still working on this or not but here is the config that I used to get the auto-instrumentor to work properly:

Gradle example:

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.dynatrace.tools:android:+'
}
}

apply plugin: 'com.dynatrace.tools.android'

dynatrace {
defaultConfig {
applicationId 'MyExampleAppID'
startupPath 'https://dev.example.com:443'
agentProperties 'DTXPrimaryDexLimit': '500', 'DTXSecondaryDexLimit': '64000'
}
}

Of course, you will need to fill in the information above with your configuration.

Command-line example (APK-Instr.properties):

DTXApplicationID=nameOfApplicationHere
DTXAgentStartupPath=https://host:port
DTXPrimaryDexLimit=500
DTXSecondaryDexLimit=64000

I hope this helps!

Thanks,

Nick

start
Newcomer

Hi Andy,

I have facing the similar error . how to fix this. Please provide your answer earliest

2018-07-13 20:01:37.838 INFO: APKit-q(1): Count: 36979 already jumbo & 0 made jumbo
2018-07-13 20:01:37.838 INFO: APKit-q(1): Strings: 17044 already jumbo & 0 became jumbo
2018-07-13 20:01:37.838 INFO: APKit-q(1): Total string count: 60527
2018-07-13 20:01:37.840 INFO: APKit-q(1): Force-jumbo did not take effect for C:\Users\dineshkumar_a\Documents\ttnlc\UAT\android-shoplc\liquidationchannel\build\outputs\apk\debug\liquidationchannel-debug\classes.dex
2018-07-13 20:01:37.898 SEVERE: APKit-v(1): 912 + 65535 = 66447 fields
2018-07-13 20:01:37.898 SEVERE: APKit-AdkInstrumentor(1): Auto-Instrumentation cannot handle this application - too many fields
Throwable occurred: h: Auto-Instrumentation cannot handle this application - too many fields