I'm creating a simple pro package to unlock features in my free app.
My free app will check if the pro package is installed and unlock pro features if its installed. I created a new project, with no activity. When I pushed it the app to my device it says it's 4 mb in size. Why is it so big when theres no code? Looking at other apps with pro unlockers, they seem very small like 100-200 kb.
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.dsmartapps.root.kerneltoolkitunlocker"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
}
Solution:
simply removed compile 'com.android.support:appcompat-v7:22.0.0' and its now 48.00kb.
Probably has to do with the your Gradle build file. It's probably using the support library, if you have no use of it you can remove it.
EDIT:
Even so, as Jared said a single support library shouldn't make your apk size that big. You should check your dependencies and assets to see what makes up for that size.
Here's a simple Gradle file for a new project:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.edd.myapplication"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
Size with compile 'com.android.support:appcompat-v7:21.0.3': around 900kb.
Size without it: around 22kb.
Related
I have a problem when I try to run my application on android device that uses API level 19 (Android 4.4.2). When I run the app on API>21 it works perfectly fine.
The errors I'm getting:
I tried setting buildToolsVersion to 19.1.0 instead of 23.0.3 but then I can't use MultiDex and I can't build the app without it.
here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "multisoft.testsurfaceview"
minSdkVersion 19
targetSdkVersion 19
versionCode 1
multiDexEnabled true
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:19.0.0'
compile files('/Users/admin/Desktop/Projects/testsurfaceview/libs/classes.jar')
}
I can't seem to find where the problem could be, any suggestions?
remove this compile files('/Users/admin/Desktop/Projects/testsurfaceview/libs/classes.jar') from dependencies.
And just add the jar in libs folder and tried it..
see this link you will find your answer.
basically you did not configure multidex properly.
enter link description here
In Android Studio the Emulators are not showing . I tried that disabling ADB Integration. but it is not working for me.
Please give me solution for this problem.
Maybe your project is not compatible (API version) with the target emulator. Check build.gradle file if the targetSDK and minimumSdk version is lower or equal to the sdk version of your Emulator.
Be sure that your compiledSdkVersion matches minSdkVersion and supported by targetSdkVersion. For example:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "zeta.sqlitetest3"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}
Due to some problems with permissions in SDK API 23 (Marshmallow) I wanted to switch back to API 21, yet I'm encountering some issues... I've read so many posts with similiar problems and tried (almost I guess) everything: I've updated all SDK Build/Platform Tools, features for API 21, Suport and Repository Libraries. Then I've cleaned up the project, rebuilt it and synchronized. Yet, I'm getting those errors:
My build.gradle looks like following:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.pablo.appcontacts"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.android.support:appcompat-v7:23.1.1'
}
I'm not very familiar with this, can anybody help me to fix this cause I really can't find a way to..?
3 Steps:
1 Edit build.grade
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.stackoverflow.answer"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
androidTestCompile 'junit:junit:4.12'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
2 Sync gradle button
3 Rebuild project
Loaded my apk file on Google play only to find that it is not compatible with any device. In the manifest file I support all screen sizes, build grade has a minimum sdk level of 15 and a target sdk level of 21.
The Apk file downloads on on my phone and tablet when loaded to Google drive. Nor sure if any one can help.
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.songbook.noo.sttrfsongbook"
minSdkVersion 15
targetSdkVersion 21
versionCode 5
versionName "1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.google.android.gms:play-services-ads:7.5.0'
}
'com.android.tools.build:gradle:0.4.3'
I'm trying to add CardView support into my app for devices lower than Android L by adding the line:
compile 'com.android.support:cardview-v7:21.+'
I've then added compileSdkVersion and targetSdkVersion to 'android-L'
Now, unless I am mistaken, I thought that this would have built on my Nexus 5 in 4.4.4, however I get the error
Failure [INSTALL_FAILED_OLDER_SDK]
Am I missing something or misunderstood this? Full build.gradle below:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-L'
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.gh.app"
minSdkVersion 15
targetSdkVersion 'android-L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
compile 'com.google.android.gms:play-services-wearable:+'
compile 'com.android.support:support-v4:20.0+'
compile files('libs/TalkClient.jar')
compile 'com.android.support:cardview-v7:21.+'
}
While CardView and RecyclerView are both new widgets being added to the support library (and therefore will be available on API 7+ devices), during the developer preview they are limited to Android L devices only.