Tag: android-gradle

Use different VersionCode for Debug/Release android gradle build

I’d like to apply different VersionCode to make apk file. For debug only fix it to 1, and for release whatever number specified in defaultConfig. Below code gives mypackage-release-1.apk file as assembleRelease artifact, which is not expected. I expected mypackage-release-10111.apk for that. why the line debug { defaultConfig.versionCode=1 } affects assembleRelease artifact? defaultConfig { versionCode […]

Unable to resolve class in build.gradle using Android Studio 0.60/Gradle 0.11

Established app working fine using Android Studio 0.5.9/ Gradle 0.9 but upgrading to Android Studio 0.6.0/ Gradle 0.11 causes the error below. Somehow Studio seems to have lost the ability to resolve the android tools import at the top of the build.gradle file. Anyone got any ideas on how to solve this? build file ‘Users/[me]/Repositories/[project]/[module]/build.gradle’: […]

Gradle Android Project with Java 8 module

As I’ve seen in this post, Java 8 is not officially supported by Android right now. So I’m interested if it is possible to build Android module with Java 7 and Java module (as a dependency) with Java 8. As an example, I’m trying to create a Gradle project that will contain one Android module […]

Transitive dependencies for local aar library

We’re making some library, basicly for our API, that we would make life easier for our external developers. So we created new library project and put Retrofit and some other libraries as dependencies. dependencies { compile ‘com.android.support:appcompat-v7:23.3.0’ compile ‘com.google.code.gson:gson:2.6.2’ compile ‘com.squareup.retrofit2:retrofit:2.0.1’ compile ‘com.squareup.retrofit2:converter-gson:2.0.1’ compile ‘com.squareup.okhttp3:okhttp:3.2.0’ } Now when we build it, it produces aar file. […]

How to convert apklib to aar

As Gradle does not support apklib dependencies how can one migrate from apklib dependencies to aar dependencies? Is it possible to either manually or automatically convert apklib dependency to aar? If yes – how, if no – why not? In this question I assume that I don’t have original project for apklib, but rather the […]

Signing Config Per Flavor Not Working

I’ve got an Android app that has 2 flavors: internal and production, and there are 2 build types as well: debug and release. I’m trying to assign signing configs based on the flavor, which according to the documentation is doable. I’ve looked and found other answers to this, but none of them seem to work. […]

Disable dependency permissions

I’m facing the following problem at the moment: I have developed app ‘A’ which uses permissions 1, 2, 3 and uses an 3rd party library ‘B’ as a dependency (added using maven & gradle). Library ‘B’ uses the permissions 4 and 5. Now when building the app, the manifest merger adds the permissions 4 and […]

Google Play Services incompatibility

I’ve been using google’s fused location services on my app for location tracking. I use Android studio and it’s gradle build system. Recently I have discovered a big issue with google’s location services. My gradle build file contained this dependency: compile ‘com.google.android.gms:play-services:+. So when I rebuilt my project, Android studio downloaded the latest version for […]

Dependency org.json:json:20090211 is ignored for debug as it may be conflicting with the internal version provided by Android

While I am running android studio, the warning below appears: Dependency org.json:json:20090211 is ignored for debug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage with jarjar to change the class packages How can I resolve this error? Thank you.

Resource entry ic_launcher already defined

can any body plz help he with this issue i want to use this library on my android studio project https://github.com/daimajia/AndroidImageSlider put when i put it in my gradle file it shows these errors Information:Gradle tasks [:app:generateDebugSources] Information:res\drawable-mdpi-v4\ic_launcher.png:0: error: Resource entry ic_launcher is already defined. Information:res\drawable-mdpi\ic_launcher.png:0: Originally defined here. Information:res\drawable-xhdpi-v4\ic_launcher.png:0: error: Resource entry ic_launcher is […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.