Tuesday, February 21, 2017

Android development tips

When developing Android apps with Android Studio, I get strange errors from time to time, whose solutions were not obvious to me:

Problem: When you create a Google Maps demo and run it using an emulator of API level 24 (e.g. Nexus 5 API 24), the app opens on the emulator with the message "...won’t run unless you update Google Play services".

Solution:  In \app\build.gradle file, com.google.android.gms:play-services version might be 10.2.0. Change it to 9.8.0 and your app will run fine.

Problem: In Android Studio, when I try to generate signed APK, I get "android execution failed for task validatesigningrelease" error.

Solution: Make sure you specify full path of key file.

Problem: When I try to generate signed APK, I get “Execution failed… method ID not in [0, 0xffff]: 65536” error.

Solution: If you are using Google Maps, limit the number of libraries you use by replacing in your gradle file the line compile ‘com.google.android.gms:play-services:9.8.0’ with
compile 'com.google.android.gms:play-services-maps:9.8.0' and
compile 'com.google.android.gms:play-services-location:9.8.0'

1 comment:

Nemco said...

Your blog has always attracted me and this particular post left me speechless. It is one of the best pieces of writing I have seen. Good job. 
android app development perth | android app development sydney