recipherus recipherus - 1 year ago 114
Android Question

Gradle does not generate an output APK

I'm trying to generate an APK for my android project on the command line.
I am running

./gradlew clean assembleProductionDebug

The output I get is:

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:processProductionDebugJavaRes UP-TO-DATE


Total time: 2 mins 29.574 secs

However, my build/outputs folder is empty. The same happens when I run
./gradlew assemble

The only relevant thing I could search for is potentially but how do I specify the objectFileDir in the build.gradle?

Note: running

./gradlew clean installProductionDebug

does successfully install the APK on my device.

Relevant build.gradle:

apply plugin: ''
apply plugin: 'git-dependencies'
apply plugin: 'testfairy'
apply plugin: 'org.robolectric'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.test.androidas"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"

signingConfigs {
release {
storeFile file("as.keystore")
storePassword "***"
keyAlias "as"
keyPassword "***"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), ''
signingConfig signingConfigs.release

productFlavors {
production {
applicationId "com.antsquare.test"
versionCode 1

staging {
applicationId "com.antsquare.test.staging"
versionCode 1

packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'

testfairyConfig {
apiKey '***'
video "wifi"
notify true
testersGroups "ME"
autoUpdate true
videoQuality "low"
videoRate "0.5"

Answer Source

First add

android { 

     compileSdkVersion 21
     buildToolsVersion "21.1.2"


     lintOptions { 
         abortOnError false 

in your build.gradle in app module.

After that clean your project by ./gradlew task clean and after that call ./gradlew task build --debug | grep .apk from console you will see apk place

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download