how to generate app-debug - android

when I pressed run button I checked apk floder where app-debug-unaligned.apk generated but app-debug.apk not refreshed. I don't know what I did that this happened. check the date in picture
EDIT: maybe people think I am lying but it's not true. maybe problem is in build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "ir.parsdroid.instagrameducation"
minSdkVersion 8
targetSdkVersion 23
versionCode 11
versionName "1.5.3"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
proguardFile 'proguard-android-optimize.txt'
zipAlignEnabled false
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:support-v4:23.0.0'
compile files('src/main/libs/adad-2.9.jar')
}

In android studio, APK gets generated when we rebuild an application or run an application.
To get debug apk :
Rebuild your project or run your project
check your_app_location\app\build\outputs\apk
Edited :
Here in your gradle file you have used 'zipAlignEnabled' :
debug {
minifyEnabled true
proguardFile 'proguard-android-optimize.txt'
zipAlignEnabled false
}
Problem is because of it. So please check how to use 'zipAlignEnabled' and try again.!!
Hope it will help.

Agree with Mamata Gelanee. You can simply remove app-debug.apk file from folder and clean the project and release new build again then check.

Related

Execution failed for task ':app:mergeDebugResources' , Unable to locate resourceFile in source-sets

Whenever I made any change to an XML file from the project and tried to run it, I got this error-
Execution failed for task ':app:mergeDebugResources'.
java.lang.IllegalArgumentException: Unable to locate resourceFile (D:Q\app\build\intermediates\merged-not-compiled-resources\debug\layout\notification_action.xml)
in source-sets.
For running the project I need to do Build > Clean Project every time if I make any changes to XML.
Below is my grade file -
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "xxxxx"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
}
I found by several testing that proguard rule is the issue for this error. Changing the proguard rules for debug solves the issue. Just need to set shrinkResources false in the debug buildTypes.
buildTypes {
debug {
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Restarting Android Studio was the solution in my case.
There is no need to set shrinkResouces false. I have set it to true and it works completely fine.
In short:
"clean project and move on"
Details:
Go to the "build tab" in the android studio > then click on "clean project".
enjoy!
"Clean Project and then run the app", this work for me you can also try this
Clearing Android Studio's cache resolved the issue for me.
Select 'File > Invalidate Caches' and then click the 'Invalidate and Restart' button.
In my case,I build my apk. I click build ->generate signed bundle or APK,
then I get the error
Unable to locate resourceFile
I delete the .idea folder in my project.
Then I build my apk again, it's no more error. it's working for me.
Build >> Rebuild Project solved my probem
just press Shift + F10 again.This is the fastest way, less time consuming than Clean -> Rebuild

AAPT error in Android studio while building the project

I have been getting this error while building my android project. I was not getting this error before but recently I updated my gradle version for supporting instant apps.
I'm wondering if thats what causing the issue.
Execution failed for task ':vuclip:processProdAutoFeatureResources'.
AAPT2 aapt2-3.2.1-4818971-osx Daemon #0: Unexpected error during link, attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.
Edit : The code is compiling fine but while building the apk using the command ./gradlew clean build, the build is failing with the above exception.
build.gradle
apply plugin: 'com.android.feature'
android {
compileSdkVersion buildVersion.targetSdk
defaultConfig {
baseFeature true
minSdkVersion buildVersion.minSdk
targetSdkVersion buildVersion.targetSdk
multiDexEnabled = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
lintOptions {
disable 'MissingTranslation'
checkReleaseBuilds false
abortOnError false
}
}
debug {
debuggable true
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
versionNameSuffix "-debug"
}
e2e {
initWith debug
debuggable true
minifyEnabled false
versionNameSuffix "-e2e"
}
auto {
initWith release
debuggable true
versionNameSuffix "-auto"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
application project(':viuapp')
feature project(':discover')
api "com.android.support:appcompat-v7:$versions.supportLibrary"
api "com.android.support:design:$versions.supportLibrary"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
api project(':boot')
api project(':utilities')
api project(':analytics')
api project(':viu-logger')
api project(':fonts')
api project(':viu-constants')
api project(':app_context')
api project(':storage')
api project(':datamodels')
}
repositories {
mavenCentral()
}
I was finally able to fix it. The issue was I have made one module as library and not added it in my base module. All your feature modules MUST be added as a dependency in your play module.
Try:
File -> Invalidate caches/Restart and Invalidate and Restart

The project is using an unsupported version of the Android Gradle plug-in (0.13.2). The recommended version is 1.0.0-rc2 [duplicate]

I've just updated my Android Studio and now my project won't build anymore. I get following error:
Error:(16, 0) Gradle DSL method not found: 'runProguard()'
Possible causes:<ul><li>The project 'App' may be using a version of Gradle that does not contain the method.
Gradle settings</li><li>The build file may be missing a Gradle plugin.
Apply Gradle plugin</li>
I didn't change anything, everything worked properly before the update. Here's my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.ochs.pipette"
minSdkVersion 10
targetSdkVersion 21
versionCode 8
versionName "1.6"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'it.sephiroth.android.library.imagezoom:library:1.0.4'
compile 'com.android.support:palette-v7:21.0.+'
}
And here's the other one:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0-rc2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
I don't know how to fix the problem, could anyone help me?
runProguard has been renamed minifyEnabled. See the changelog here for confirmation - version 0.14.0 (2014/10/31) of the Android Gradle plugin made the swap.
As #stkent said, runProguard has been renamed to minifyEnabled in version 0.14.0 (2014/10/31) of Gradle.
To fix this, you need to change runProguard to minifyEnabled in the build.gradle file of your project. For example,
buildTypes {
release {
runProguard false // Does not exist anymore...
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
would be replaced by
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
You can see other issues here but this worked for me.
runProguard has been renamed to minifyEnabled in version 0.14.0 (2014/10/31) of Gradle.
To fix this, you need to change runProguard to minifyEnabled in the build.gradle file of your project.

After Android Studio update: Gradle DSL method not found: 'runProguard()'

I've just updated my Android Studio and now my project won't build anymore. I get following error:
Error:(16, 0) Gradle DSL method not found: 'runProguard()'
Possible causes:<ul><li>The project 'App' may be using a version of Gradle that does not contain the method.
Gradle settings</li><li>The build file may be missing a Gradle plugin.
Apply Gradle plugin</li>
I didn't change anything, everything worked properly before the update. Here's my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.ochs.pipette"
minSdkVersion 10
targetSdkVersion 21
versionCode 8
versionName "1.6"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'it.sephiroth.android.library.imagezoom:library:1.0.4'
compile 'com.android.support:palette-v7:21.0.+'
}
And here's the other one:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0-rc2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
I don't know how to fix the problem, could anyone help me?
runProguard has been renamed minifyEnabled. See the changelog here for confirmation - version 0.14.0 (2014/10/31) of the Android Gradle plugin made the swap.
As #stkent said, runProguard has been renamed to minifyEnabled in version 0.14.0 (2014/10/31) of Gradle.
To fix this, you need to change runProguard to minifyEnabled in the build.gradle file of your project. For example,
buildTypes {
release {
runProguard false // Does not exist anymore...
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
would be replaced by
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
You can see other issues here but this worked for me.
runProguard has been renamed to minifyEnabled in version 0.14.0 (2014/10/31) of Gradle.
To fix this, you need to change runProguard to minifyEnabled in the build.gradle file of your project.

Android Studio : Error:Execution failed for task ':app:packageRelease'. > Failed to read key from store: Cannot recover key

This is my first time building my apk since the Android Studio (Beta) 0.8.1 release...so Im not sure if its related to this. I think that performing the updated could have modified by AS settings, but Im not sure. Can anyone possibly tell me why Im getting this error. Here is a copy of my build.gradle file. Please let me know if you need anything else.
This is happening when i try to generate an apk for all of my apps since ive updated to the 0.8.1 Beta Release. Has anyone else had this problem.
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 4
versionName "4.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree('src/main/libs')
compile files('src/main/libs/Parse-1.5.1.jar')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.google.android.gms:play-services:4.3.23'
}
Your problem may be your Key store password and Key password do not match. The easiest and most simple way to fix this is by creating a new Key store path and setting the password to the same as your Key password.
buildTypes {
release {
minifyEnabled true
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
productFlavors {
flavor1 {
}
flavor2 {
proguardFile 'some-other-rules.txt'
}
}

Categories

Resources