The WIFI_SERVICE must be looked up on the Application context...

Issue

Generating signed APK in Android Studio 2.3 fails with following error:

Error: The WIFI_SERVICE must be looked up on the Application context or memory will leak on devices < Android N. Try changing  to .getApplicationContext()  [WifiManagerLeak]

ListView Pop-Up Context Menu broken in Android 7 (API 24)

Issue

ListView context menu pop-up doesn't work properly in Android 7.0 and 7.1 Nougat (API 24 and API 25).

Instead of the full menu appearing in the middle of the screen, it now appears collapsed to a single item and either at the very top or at the very bottom of the screen.

Here is the expected behaviour:

Here is how the context menu looks in Android 7.1.1:

The app uses com.android.support:appcompat-v7 library and Theme.Holo.Light theme.

The number of method references in a .dex file cannot exceed 64k

Gradle build fails with error "The number of method references in a .dex file cannot exceed 64k "

As the error suggests you cannot have more than 64k methods in one classes.dex file. One way around this is to use enable MultiDex in your build.gradle

 
multiDexEnabled true
 

java.lang.OutOfMemoryError: GC overhead limit exceeded

After upgrading Google Play services library from 9.4.0 to 10.2.0 Gradle build fails with following error:

Information: Gradle tasks [:app:assembleDebug]
Error: UNEXPECTED TOP-LEVEL ERROR:
Error: java.lang.OutOfMemoryError: GC overhead limit exceeded
Error: Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
Information:BUILD FAILED



Newsletter

Subscribe to receive occasional updates on new posts.
Your email will not be used for any other purpose and you can unsubscribe at any time.
Please wait