Android SDK Troubleshooting


I think I found a bug in the Pngme SDK, what should I do?

  • First, remove the dependency with the SDK and check that the bug is not reproduced.
  • If the bug does not reproduce, then it could be a potential issue with the SDK.
  • Check our sample apps and look for the one that has the most similar development environment to yours. Feel free to clone it and compare configurations and implementations with yours; this might bring some light to your issue.
  • Capture a clean trace of the error. For example, using adb logcat while reproducing the error.
  • Check the trace and verify that you cannot fix the error message. Check some known issues in the Q&A below.
  • If you get blocked at this point, please send us the bug trace and as much context as you can provide so we can reproduce the error and help you with the integration (a video recording of your screen while reproducing it would be great!)

I get errors related to not compatible versions of Kotlin, Gradle, plugins, ...

  • Please, update your development environment (i.e. Android Studio) to the latest version.
  • By using latest versions of the IDE you get a lot of help about what could be wrong and how to fix the issues.
  • Keep in mind that depending on your target configuration for your app, you need to honour the version restrictions between the components of the build chain (i.e. Gradle and Android Gradle Plugin [AGP] follow this table)

I got the message ´Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified´

  • This means that you are using targetSdkVersion >= 31 in your build.gradle file.
  • There is a known bug in Android 12 API 31 that got fixed in posterior versions, but that requires an additional dependency to be added to your app.
  • Please, add the following dependency to your build.gradle file at the app level (not the project level):
    implementation ''
  • If you are using Java instead of Kotlin, please use the following dependency:
    implementation ''

I got the message like ´Installed Build Tools revision x.y.z is corrupted. Remove and install again using the SDK Manager.`

  • The most probable cause is that you are using an old version of the Gradle plugin and or Gradle itself.
  • You need to upgrade your environment. Keep in mind the correspondence between Gradle and the Gradle plugin versions.
  • More info here steps to update your Gradle plugin.
  • Tip: Keep the build tools version on a lower version and keep bumping your Gradle and Gradle plugin versions. Once you have a stable build, start bumping the tools version. This way you ensure that Gradle will be compatible with the tools, which is the main cause of the problem.
  • IMPORTANT: DO NOT FOLLOW TUTORIALS/ANSWERS where you are supposed to copy files from the builds folder. That is a temporary patch that will not work in the long term and will make your project a mess in the future.

I upgraded my project to use a new version of the Android SDK and got java.lang.reflect.InvocationTargetException

Full initial message could look like:

Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
   > java.lang.reflect.InvocationTargetException (no error message)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
  • This means that some of your dependencies (or your code) is failing to use the reflection capabilities of java.lang.reflect
  • This is probably due to an incompatibility between sub-dependencies.
  • Please, run ./gradlew build --stacktrace and pay attention to the package that is causing the trouble.
  • If you use Android Studio, it is quite probable that the IDE is warning you that you should upgrade that dependency already.
  • In any case, check what is the latest version of the dependency (or the latest that keeps compatibility with the rest of your app) and upgrade it in your Gradle file. (i.e.: this happens quite often for com.squareup.moshi, which is quite common)

I have some weird problem that I did not have yesterday about some class not being available or being incompatible

  • This might happen after you bump your Android environment's versions or after removing and adding dependencies.
  • The best practice is to do a clean build, removing any chance that caches are messing with your project.
  • For example, for React Native apps, you can clean your environment by stopping your local dev server and running these commands:
watchman watch-del-all
rm -rf node_modules
yarn cache clean
yarn install

Then restart your server:

yarn start --reset-cache

And launch your app:

yarn android

What is the Pngme class that should be included in proguard?


This tip is focusing on a specific context, such as the one we have in our React Native demo app. You can apply the appropriate clean-up method that you need for your app following the example we are given.