I am getting this error when i am trying to release new version of the app
I am getting the same error if i change the android-minSdkVersion to 23 also.
Help me out! Thanks.
Change to compileSDKVersion as follows : *Remember to use the latest buildToolVersion with proper SDK Version installed .
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.company.yourapp"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
bu...
Related
I cannot get the Wear1 signed APK into the res/raw folder of my signed mobile apk file since using the latest android gradle plugin 3.0.1
I have to use the latest gradle to get the google repo for certain dependencies.
I have checked the wear apk and it is signed with my production signature.
I know the preferred method going forward is to unbundle and I can successfully do that but Google's acknowledged latency issue on installing Wear 1 apps that way makes it unattractive at this time.
Below are my gradle files.
Project build.config
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
Mobile build.config
apply plugin: 'com.android.application'
apply from: rootProject.file('shared-config/android-signing.gradle')
android {
compileSdkVersion 27
buildToolsVersion '27.0.2'
defaultConfig {
applicationId "com.me.myapp"
minSdkVersion 18
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
signingConfig signingConfigs.release
}
}
flavorDimensions "environment"
productFlavors {
development {
dimension "environment"
}
production {
dimension "environment"
}
}
}
configurations {
developmentReleaseWearApp
productionReleaseWearApp
}
dependencies {
implementation 'com.google.android.gms:play-services-wearable:11.8.0'
implementation 'com.android.support:support-compat:27.1.0'
implementation 'com.android.support:percent:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
developmentReleaseWearApp project(path: ':wear', configuration: 'wear1Release')
productionReleaseWearApp project(path: ':wear', configuration: 'wear1Release')
implementation 'com.android.support:support-annotations:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:preference-v14:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:support-v13:27.1.0'
provided 'com.google.android.wearable:wearable:2.2.0'
implementation 'com.google.android.support:wearable:2.2.0'
}
Wear build.config
apply plugin: 'com.android.application'
apply from: rootProject.file('shared-config/android-signing.gradle')
android {
compileSdkVersion 27
buildToolsVersion '27.0.2'
publishNonDefault true
defaultConfig {
applicationId "com.me.myapp"
minSdkVersion 23
targetSdkVersion 27
versionCode 2
versionName "1.0"
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
signingConfig signingConfigs.release
}
}
flavorDimensions "wearVersion"
productFlavors {
wear1 {
dimension "wearVersion"
// Use the defaultConfig value
}
wear2 {
dimension "wearVersion"
minSdkVersion 24
}
}
configurations {
wear1Release
wear2Release
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.google.android.gms:play-services-wearable:11.8.0"
implementation "com.android.support:support-compat:27.1.0"
implementation "com.android.support:support-annotations:27.1.0"
implementation "com.android.support:appcompat-v7:27.1.0"
implementation "com.android.support:recyclerview-v7:27.1.0"
implementation "com.android.support:percent:27.1.0"
implementation "com.android.support:support-v4:27.1.0"
implementation "com.android.support:wear:27.1.0"
implementation "com.google.android.support:wearable:2.2.0"
implementation "com.android.support.constraint:constraint-layout:1.1.0-beta5"
provided 'com.google.android.wearable:wearable:2.2.0'
}
settings.gradle
include ':mobile'
include ':wear'
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
I was having the same problem this week. Today I finally managed to get the wear app correctly embedded into the mobile app APK using the 3.0.1 gradle. I added a productFlavor to my wear app build.gradle to match the productFlavor of the mobile app that I was generating the build for. Trying to specify a differently-named wear app configuration in the mobile app's build.gradle dependency list seemed to be the problem for me.
I would suggest trying to add development and production flavors to your wear app build.gradle:
development {
dimension "wearVersion"
// Use the defaultConfig value
}
production {
dimension "wearVersion"
// Use the defaultConfig value
}
and then change your mobile app build.gradle dependency to simply:
wearApp project(path: ':wear')
When you generate the build, it should match productFlavor to productFlavor by default and that is working for me.
I was wondering if it is possible to use the versionName variable in the DefaultConfig of my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "app"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
In my gitlab-ci file:
stages:
- build
release:
stage: build
only:
- release
script:
- ./gradlew assembleRelease
# Here I need to use the value of versionName in my gradle file.
Is there a simple way of doing this?
I ended up doing it with a command line script in the gitlab-ci file:
export VERSION = $(grep -E "versionName " app/build.gradle | cut -d "\"" -f2)
This way I can access the versionName with $VERSION inside the file.
I keep on failing to upload the signed APK file generated from Android Studio, even though I have tried many different solutions to solve it.
This is what I get when uploading:
I have also seen some solutions to write zipalign commands, but I always get the "command not found" message when entering the command in my mac's terminal.
And this is my configuration in the build.gradle (Module: app) file inside the project:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.name.product"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
}
repositories {
flatDir {
dirs 'libs'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.squareup.okhttp3:okhttp:3.0.1'
compile(name:'material-search', ext:'aar')
}
I found this solution and it solved my problem:
https://stackoverflow.com/a/37842438/4846301
It was all about changing 1 line in the build.gradle file to this:
'com.android.tools.build:gradle:2.1.2'
Ok, here is my current build.gradle:
apply plugin: 'com.android.application'
apply from: '../config.gradle'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId ""
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
resValue "int", "amountOfTables", amountOfTables
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
howManyTables.execute()
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.pnikosis:materialish-progress:1.4'
}
and that's the config.gradle:
def amountOfTables = 15
task howManyTables << {
println amountOfTables
}
The question is:
Why can I get access to howManyTables task from config.gradle. But can't get access to defined variable? I want to create custom config.gradle with predefined values. And then use them as variables in my Android app. (like baseURL, type of data, etc...). And them, depending of that data build my logic. Anyway, the question is clear i hope ;) Any ideas?
Because You defined the variable with def - so it's local in the script itself. Try:
config.gradle
project.ext.amountOfTables = 15
build.gradle
apply from: 'config.gradle' //correct path should be here
println project.amountOfTables
I have an error when I want to add Robospice library; this is my build.gradle file:
apply plugin: 'android'
android {
// Check on it to know witch Android API level is necessary:
// http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels
compileSdkVersion 19
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile "com.android.support:support-v4:18.0.+"
compile "com.android.support:appcompat-v7:18.0.+"
compile "com.octo.android.robospice:robospice:1.4.11"
}
But unfortunately, Gradle gives me this error:
duplicate files during packaging of APK D:\blablabla\build\apk\mtc-debug-unaligned.apk
Execution failed for task ':mtc:packageDebug'.
Duplicate files copied in APK META-INF/LICENSE.txt
File 1: C:\Users\Anthony.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-lang3\3.2.1\66f13681add50ca9e4546ffabafaaac7645db3cf\commons-lang3-3.2.1.jar
File 2: C:\Users\Anthony.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-lang3\3.2.1\66f13681add50ca9e4546ffabafaaac7645db3cf\commons-lang3-3.2.1.jar
Thanks for your help !
Anthony
uses this code to solve your problem:
android{
packagingOptions {
exclude 'META-INF/LICENSE'
}
}
but if the problem remains, you must look for the file you need ignorie during generation of apk.and add to packagingOptions like in the code above