Error while generating a signed APK - java

So, everytime I try to generate a signed apk this error comes and it won't let me finish generating signed apk:
Lint found fatal errors while assembling a release target.
To proceed, either fix the issues identified by lint, or modify your build script as follows: ... android {
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
} }
...
Here is the app gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.gmail.andre00nogueira.feelproject"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
renderscriptTargetApi 24
renderscriptSupportModeEnabled true
}
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:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.wonderkiln:blurkit:1.0.0'
compile 'com.android.support:design:26.1.0'
compile 'com.google.firebase:firebase-core:12.0.0'
} apply plugin: 'com.google.gms.google-services'
And here is the project gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
} }
allprojects {
repositories {
google()
jcenter()
} }
task clean(type: Delete) {
delete rootProject.buildDir }

Try this in app gradle inside android{}
lintOptions {
checkReleaseBuilds false
}

This usually as to do with the method you use to generate the signed APK, if you use another method to generate the signed APK you will be able to generate a signed APK.
Hope it helps, good luck!

Related

ERROR: Cannot create a proxy class for abstract class 'GoogleServicesTask'

I get this error when trying to sync my android studio project after adding the lines required in a firebase project.
Just that, it's a common android studio project in which i just want to apply a firebase database. Please, if anyone knows what could be happening?
Thanks.
PD: I already searched this error on other stackoverflow questions, but none of the answers worked for me :(
Here is my build.gradle(Project):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.3.4'
//classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my buid.gradle(app):
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.example.proceedingmanager"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.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:2.0.4'
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 platform('com.google.firebase:firebase-bom:26.2.0')
implementation 'com.google.firebase:firebase-analytics'
}
Update:
Hey! I solved it by just updating my android studio version to a newer one.
But no, i don't know how to solve it without doing that

how to solve gradle faild sync:SSL handshake connection when trying to download recycleview?

I've tried to download RecycleView in order to use in my project but this error keeps occurring and download fails.
Gradle sync failed: Could not resolve all dependencies for
configuration ':app:debugRuntimeClasspath'. Could not determine
artifacts for androidx.recyclerview:recyclerview:1.0.0 Could not
get resource
'https://dl.google.com/dl/android/maven2/androidx/recyclerview/recyclerview/1.0.0/recyclerview-1.0.0.aar'.
Could not HEAD
'https://dl.google.com/dl/android/maven2/androidx/recyclerview/recyclerview/1.0.0/recyclerview-1.0.0.aar'.
Remote host closed connection during handshake SSL peer shut
down incorrectly Consult IDE log for more details (Help | Show Log)
(12 s 965 ms)
This is the Project Build Gradle:
buildscript {
repositories {
jcenter()
mavenCentral()
google()
maven { url 'http://repo.maven.apache.org/maven2' }
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and this is the Module:App build Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.aden.adenmarket"
minSdkVersion 16
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 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.firebase:firebase-firestore:20.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
Since no one answered my question, I'll post this answer. Maybe it'll help someone who may face an issue like this. I solved this problem by updating Firebase libraries and
updating these two dependencies to the last version and it worked successfully .
//module:app
implementation 'com.google.firebase:firebase-auth:18.1.0'
implementation 'com.google.firebase:firebase-firestore:20.1.0'
implementation 'com.google.firebase:firebase-core:17.0.1'
//project Build Graddle
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.3.0'

Switching Android module from library to application results in "Unable to resolve dependency for :app#debug/compileClasspath"/

I have an android app I want to import to my project as a module. The module syncs and compiles fine with apply plugin: 'com.android.application' However, there are classes from the module that I want to use in my project. To do this, it seems like I need to switch the gradle for the module to read apply plugin: 'com.android.library' as per this question. However, changing the module from an application to a library results in the following error log:
Unable to resolve dependency for ':app#debug/compileClasspath': Failed to transform file 'OCRTest-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Failed to transform file 'OCRTest-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
...
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Failed to transform file 'OCRTest-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
So far I have tried invalidating caches and restarting Android Studio, as that was a common suggestion. I have also seen it suggested to delete the .gradle file altogether. Is that safe to do? Also, the main thing I want to do is be able to use Java classes from the module in my app's activities. If there is a better way to go about doing this, let me know.
Here is the code for my .gradle files.
settings.gradle:
include ':app'
include ':OCRTest'
build.gradle(Project):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(Module: OCRTest): This is the module that contains classes I want to use in my app
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 27
}
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard.cfg'
}
}
}
dependencies {
implementation 'com.rmtheis:tess-two:9.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
}
build.gradle(Module: app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "org.noblis.thirdeye"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
matchingFallbacks = ['debug']
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.rmtheis:tess-two:9.0.0'
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 project(path: ':OCRTest', configuration: 'default')
}
Remove the following line from build.gradle(Module:app):
implementation project(path: ':OCRTest', configuration: 'default')
Sync Gradle files.
Replace settings.gradle with this line:
include ':app', ':OCRTest'
Sync Gradle files again.
Now goto Project Structure>Add Module dependency and add module.
Hope this helps :)

Getting an error "could not find method implementation()" in Android Studio

I'm getting this ERROR message.
Could not find method implementation() for arguments [project ':app']
on object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Here's my project level's gradle file :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url "https://maven.google.com" }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://maven.google.com" }
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
dependencies {
implementation project(':app')
}
Here's my app's gradle file :
apply plugin: 'com.android.application'
apply plugin: 'java-library'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.therationalbloke.myapplication"
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-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation project(':app')
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'
}
NOTE : I'm already aware of the following.
The "compile" has been replaced by "implementation" in Gradle 3.0 or
higher.
Yes, I'm using Android Studio's latest version and according to Rob, I should prefer the old one. But the thing is that I was haunted
by a lot of technical issues in that version (a lot of them included
stuff which is now outdated).
I've read almost every solution to this problem on Stack Overflow, Github. All of them are either asking to use implementation() instead
of compile (which I'm already using), or they're asking to check if
the Gradle version is 3.0+.
I've tried changing all the "implementation" to "compile" on suggestion of one user on Stackoverflow.
I've tried importing a lot of libraries as suggested by a lot of people in different communities.
Some info about my Android Studio
Android Studio - 3.1.3
Android Plugin Version - 3.1.3
Gradle Version - 4.4
Screenshot of the situation
I've never seen something like implementation project(':app') on a gradle file.
Here you have an example of a working gradle file, try deleting implementation project(':app') and resync.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.amvt_notebook4.codigoqrtest"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies
{
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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.google.android.gms:play-services:10.0.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation files('build/libs/mail.jar')
implementation files('build/libs/additionnal.jar')
implementation files('build/libs/activation.jar')
implementation files('build/libs/jtds-1.3.1.jar')
implementation 'com.android.support:multidex:1.0.3'
}

The app is working fine on connected devices but its showing error when i try to build its apk

There is no error when I try to run it on connected devices or on emulator but, when I try to build its apk file, it's generating this error. Please help me out if you find any clue of mistake here. Thanks
The error is:
Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException:
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex`
The build.gradle is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.ihtesham.demoapp"
minSdkVersion 16
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'
multiDexEnabled true
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
androidTestImplementation 'com.android.support.test:runner:1.0.1' //1.0.1
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.1'
//Adding libraries
implementation 'com.github.glomadrian:MaterialAnimatedSwitch:1.1#aar'
implementation 'com.firebaseui:firebase-ui-auth:3.1.3'
implementation 'com.firebase:geofire-android:2.1.2'
implementation 'com.github.d-max:spots-dialog:0.7#aar'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.android.support:design:26.1.0' // 26.1.0
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.google.firebase:firebase-database:11.8.0' //11.8.0
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.android.gms:play-services:11.8.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0' //11.4.2
testImplementation 'junit:junit:4.12'//11.8.0
}
apply plugin: 'com.google.gms.google-services'
The project's build.gradle is:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven{
url 'https://maven.google.com'
}
maven{
url 'https://dl.bintray.com/glomadrian/maven'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
remove
multiDexEnabled true
Or do it
multiDexEnabled false
from your project's build.gradle because the exception you are facing is telling something about not being able to compile the dex code.
after removing that line or doing it false try to CLEAN and then ->REBUILD and go for buildapk.
if you are going for releasing your apk then you have to do some more amends in your application's build.gradle like this
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
multiDexEnabled false
}
in your program-rules pro file you have to put these lines too its good practice well to me actually
-keep class * {
public private *;
}
if that does not work! keep the multidexEnabled true and add this in your project dependencies
implementation 'com.android.support:multidex:1.0.2'

Categories

Resources