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

Auto instrumentation fails after upgrading Android Gradle Plugin to 4.1.0

uladzislau_yarm
Newcomer

Hi

We're manually instrumenting our .apk using AppMon 7.2.7.1233.

After bumping the Android Gradle Plugin version from 4.0.1 to 4.1.0 the instrumentation has started constantly failing with the following exception:


line 134: 51916 Segmentation fault: 11 "${TOOLS_OS}/zipalign" -p -f 4 "${INSTRUMENTED_APK}" "${ZIPALIGNED_APK}"
Zipaligning completed - Instrumented and zipaligned APK: ../dynatrace/../app/build/outputs/apk/release/app-release/dist/app-release-zipaligned.apk
Signing non-release APK ...



Exception in thread "main" java.io.IOException: Failed to deduce Min API Level from APK's AndroidManifest.xml. Use --min-sdk-version to override.
at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:215)
at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:93)
Caused by: java.util.zip.ZipException: zip file is empty
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.zip.ZipFile.<init>(ZipFile.java:169)
at com.android.apksigner.ApkSignerTool.getMinSdkVersionFromAndroidManifest(ApkSignerTool.java:779)
at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:213)
... 1 more

Everything works fine if AGP reverted back to 4.0.1.

minSdkVersion=19 is set in the app's build.gradle file.

 

What is the reason of the issue? How can we address it with the given version of AppMon and AGP?

4 REPLIES 4

Thomas_Wirth1
Dynatrace Pro
Dynatrace Pro

Hey Uladzislau,

Version 7.x has already reached its end-of-life and was replaced by version 8.x. This agent version is compatible with AppMon 7.2. We recommend that you upgrade to the latest version (see documentation).


Version 8.x uses a different approach for instrumentation that is directly coupled to the build process. That's the reason why the instrumend.cmd and instrument.sh scripts are gone. Now auto-instrumentation is directly done by the Dynatrace Android Gradle plugin. This approach reduces the instrumentation time significantly.

uladzislau_yarm
Newcomer

@Thomas W. can you provide a simplified migration guide or is it possible to get support on Migration from the Dynatrace? We, Android devs, don't work with Dynatrace a lot, so have little idea of what really need to be updated.

I can se ein code that we include Dynatrace as a module dependency and then cal its Dynatrace#enterAction method in one place in code. And that's it. We don't do any extra integration.

What should be the migration steps for us?

This documentation page explains the required setup steps for the plugin. When you follow the first three steps, then the app will be automatically instrumented by the plugin. Steps 4 and 5 explain how you can further customize the instrumentation process.

To get the same instrumentation behavior as version 7.2, you have to convert the old DTX properties into the new DSL configuration (as shown in the migration page).


If you need help for this process, then you can open a support ticket. When you provide the build.gradle files and the configuration file with the DTX properties, then the support team can guide you through the setup steps.

Karolina_Linda
Community Team
Community Team

The post has been moved to the AppMon Open Q&A forum.

Keep calm and build Community!