Android support multidex library implementation

The Blog was the old solution. With Android Studio 0.9.2 & Gradle Plugin 0.14.1, you only need to: Add to AndroidManifest.xml: . android:name=”android.support.multidex.MultiDexApplication” or Add MultiDex.install(this); in your custom Application’s attachBaseContext method or your custom Application extend MultiDexApplication add multiDexEnabled = true in your build.gradle . android { defaultConfig { … multiDexEnabled = true } … Read more

Gradle Duplicate Entry: java.util.zip.ZipException

When you added the com.android.support:multidex dependency you actually added some dependencies that collide with other dependencies. I solved it by: ————— 1. searching for the class, in you case the “RequestWeakReference.class” (in AndroidStudio just hit Ctrl+N on Windows or CMD-O on Mac) 2. See which jar contains it – Android Studio will write it in … Read more

“Hello world” Android app with as few files as possible, no IDE, and text editor only

Yes you can easily do it ALL from the command line (NO IDE involved, I promise). This uses the old faithful Apache Ant. It does not use Gradle, that takes more work. To Summarize What you type is (just 2 lines to produce an apk): android create project –target “android-16” –path basj –activity TestActivity –package … Read more

Apache HTTP connection with Android 6.0 (Marshmallow)

This page discusses the removal of the Apache HTTP classes, and it suggests a workaround as well: To continue using the Apache HTTP APIs, you must first declare the following compile-time dependency in your build.gradle file: android { useLibrary ‘org.apache.http.legacy’ } In my case Android Studio still complained that it couldn’t find these classes, but … Read more

Android studio – Failed to complete gradle execution – error in opening zip file

An “error in opening zip file” tends to mean that a file that Gradle has downloaded has somehow become corrupted — this might be the download of Gradle itself (which the wrapper does), or a dependency that Gradle has downloaded to run your build. Gradle doesn’t attempt to detect or resolve the problem, so you … Read more

Error:Failed to resolve: android.arch.core:common:1.1.0

I resolve this issue by moving maven {url “https://maven.google.com”} before jcenter(), like this: repositories { maven { url “https://maven.google.com” } jcenter() maven { url ‘https://jitpack.io’ } } This is because I find jcenter() repository has deleted the directory of android.arch.core, so we have to get this file (android.arch.core:common-1.1.0.jar) from “https://maven.google.com”

Change apk name with Gradle

As CommonsWare wrote in his comment, you should call appendVersionNameVersionCode only for staging variants. You can easily do that, just slightly modify your appendVersionNameVersionCode method, for example: def appendVersionNameVersionCode(variant, defaultConfig) { //check if staging variant if(variant.name == android.buildTypes.staging.name){ if(variant.zipAlign) { def file = variant.outputFile def fileName = file.name.replace(“.apk”, “-” + defaultConfig.versionName + “-” + defaultConfig.versionCode … Read more

How to configure NDK with Android Gradle plugin 0.7

Looking through the gradle plugin code, I found the following that helped me use both NDK and prebuilt native libraries: To simply Link in Prebuilt Native Libraries, just add an ndk section to your task. For instance, I added it below in productFlavors. The abiFilter is the folder name the libs are stored in. abiFilters … Read more

Android – Inner element must either be a resource reference or empty

When declaring id in resources, the body should be empty <item type=”id” name=”id_name” /> For more info please have a look on below link https://developer.android.com/guide/topics/resources/more-resources#Id So as Oliver Manyasa mentioned, it should be as below <?xml version=”1.0″ encoding=”utf-8″?> <resources> <item name=”tv_deviceName” type=”id”/> </resources>