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.
Related
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
what are the ways to reduce the apk file size?
and what are the things affecting it?
I noticed sometimes when I build the apk, the size goes above 100k and other times it will be around 20k what is the thing it depends on exactly?
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.dynamiclist"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildToolsVersion '28.0.3'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.google.firebase:firebase-database:19.2.1'
implementation 'com.karumi:dexter:6.0.2'
api 'com.otaliastudios:cameraview:2.6.1'
implementation 'com.google.firebase:firebase-ml-vision:24.0.1'
implementation 'com.google.firebase:firebase-ml-vision-barcode-model:16.0.2'
implementation('com.journeyapps:zxing-android-embedded:3.6.0')
implementation 'com.android.support:multidex:1.0.3'
}
this is the gradele that I have used when it reached 100k if that helps
First you have to Analyse the apk file which gives the information of how much Size allocated to the Resources......
so for analyze apk for Build Apk using:-
Build > Build Bundles(s)/APK(s) > Build APK(s).
After the Build Apk you can analyse your apk using:-
Build > Analyze APK...
this will Gives you the information about the Size are taken by Resources.
using which you can Remove unwanted Resources for Decrease Apk size.
I am sure This will Help you for Decrease The Apk Size..
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
The android application has a dependency: com.googlecode.objectify
The following error is thrown while building the project:
com.android.builder.dexing.DexArchiveBuilderException: Failed to process /home/homecomp/.gradle/caches/modules-2/files-2.1/com.googlecode.objectify/objectify/5.1.16/148ca59a5f89b394eb998ce1894d222c7e11131d/objectify-5.1.16.jar
Here is the complete build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.homecomp.myapplication"
minSdkVersion 21
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-alpha3'
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'
implementation 'com.googlecode.objectify:objectify:5.1.16'
}
error screenshot
I would be very surprised if the Google App Engine SDK (which Objectify depends on) works on Android. If it did, it would certainly require the Remote API.
You might try Objectify6, which uses a newer Google SDK and REST-based API and is more likely to work on Android. You should check.
That said... directly accessing your datastore from a mobile app? Sounds like a terrible idea.
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