Currently i have version_name = 1.0 and version_code = 1
I want to upgrade the version_code which is in version.properties in my app folder when i am generating an APK release of it.
Please help me?
Here is my build.gradle of my android app apk.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.dummyproject"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
never thought about such feature, may be useful... but note that there are some cases when you need to produce release-signed apk just for testing e.g. check some signing or proguard config works well. but still versionCode may be incremented, why not...
note that this feature will edit your code (should change versionCode permanently, for next +1), so for this purpose (if possible) may exist some plugin or script for Android Studio, but gradle itself won't edit own currently-executing build file. you may override this value (versionCode) for release flavor, but this will be fixed still, as every build command will set versionCode=versionCode+1 temporary without knowledge how many builds were made previously
Related
The login with Twitter works ins debug, but not in release, also the size of the apk is bigger in the debug.
Where is the problem??
i have 3 activitys
this is the build.grandle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.PolDevs.MyClickerGame"
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.firebase:firebase-database:19.1.0'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
implementation 'com.google.firebase:firebase-core:17.2.2'
implementation 'com.twitter.sdk.android:twitter-core:3.1.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
Open the documentation for all the libraries you are using and double check if they have any specific rules to be put in proguard since that is enabled during release build. proguard obfuscates you’re APK when making a release build, which means removing code like annotations and comments etc. which also reduces the size of the apk.
So for some libraries to work, you have to specify some rules in your proguard file to no obfuscate certain things. Common error to be careful of when maiking debug and release builds.
I just build a release APK and tried it. It works fine in all the devices that is having API of 7.0 or high. But when I tried testing it in marshmallow or devices with lower API than marshmallow, then the apk was not installed. It showed the error message App not installed. I have my minSdkVersion as 21 but still this problem happens.
This is my build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.apollographql.android'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.leadershipboard"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.core:core-ktx:1.0.0-rc02'
implementation 'com.apollographql.apollo:apollo-runtime:0.4.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}
Also While generating the signed APK I ticked both V1 and V2 checkboxes. Since I saw that in a solution but that didn't work.
What is the problem here and how can I resolve this?
Thanks in advance.
Do you have this app already installed on this device? Maybe you were using that same device as an emulator.
In this case, uninstall the earlier app and try again.
Also, if you have installed any app with same package name (i.e. maybe you changed the app name or tried opening some specific activity on your device), look out for all those in your applications and uninstall all of them.
Hope this works!
I am new in creating library from android studio. I have been reading this tutorial in developers website. So to try it out I have created a new project and without doing anything I edited the app level build.gradle file and here is how it looks like:
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Now when I am trying to build an apk(which is supposed to build aar file) isn't building anything as I cant see any confirmation message like something when I build an apk nor can't I find anything inside app/build/outputs folder..
Where am I going wrong? Is there anything that I am understanding wrong in the tutorial?
Here is the project structure - screen shot
I have looked at numerous sites and the suggestions provided here at Stack Overflow. Everything works fine with my Android Studio, except the design view does not display anything. I can drag and drop widgets or modify the XML code by hand and the text gets updated fine, but the changes just don't register on the design or blueprint. I have tried deleting and reinstalling the IDE, changing the SDK version, doing build--> clean, resetting the cache, and adding dependencies. Below is my build.gradle Anyone with a critical eye have suggestions? I don't know what I'm doing.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.mydrinkmixer.somerestaurant.mydrinkmixer"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard- android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
I get this error when trying to compile an android studio project, that uses the "weka" machine learning algorithm. The project is part of an uni assignment, just to be clear.
the build.gradle looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "ac.univie.em2.project"
minSdkVersion 24
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '26.0.2'
}
dependencies {
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// https://mvnrepository.com/artifact/nz.ac.waikato.cms.weka/weka-stable
implementation 'nz.ac.waikato.cms.weka:weka-stable:3.8.0'
}
Things we already tried:
1) adding the multidexenabled true flag
2) clean and rebuild
EDIT: We found a workaround, by not using maven for the weka dependency, but using the 3.6.6 jar directly. I would still love it if someone could tell me what the problem in out build.gradle file is