I am using AS 3.1 with gradle-4.5-all.zip
and main build.gradle
:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
An app-level
build.gradle
looks like following:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example"
minSdkVersion 14
targetSdkVersion 27
versionCode 6
versionName "1.00"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
implementation 'ch.acra:acra:4.6.1'
implementation 'commons-validator:commons-validator:1.5.0'
implementation 'com.android.support:support-v13:27.1.1'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.google.zxing:core:3.3.0'
}
and works fine when I set up a debug
version under AS 3.1 to my phone, but when I try to make release
apk it shows me an error:
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
}
}
As I can see in the lint-results-release-fatal.html
the reason is:
I would not like to change lintOptions
to supress this error because it doesn't solve the problem, it just hide it. More over, when I use
implementation files('libs/commons-validator-1.5.0.jar')
instead of
implementation 'commons-validator:commons-validator:1.5.0'
the release
apk is compiled without any error messages. Is it a some gradle
bug or what!?
P.S. I have attached a file androidDependencies.txt. Package commons-logging
doesn't appears in the dependencies at all! How is it possible to get the solution of above problem analysing this file?
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 } } ...
What you can do is execute task, It will create a build, and as well list down the error (s). This way you can actually correct the errors. I had some missing jars and behind a corporate firewall and there was an attempt to download them during lintVitalRelease.
This way you can view and fix the real issues. You can still view them from app\buildeports\lint-results-release-fatal.html file without using aforementioned manual inspection menu. Although it's not recommended you can also suppress the lint warnings by adding below code into your build.gradle as Android Studio suggests.
the release apk is compiled without any error messages. Is it a some gradle bug or what!?
It seems like that dependency has a package which conflicts with the Android itself. The reason why it works without implementation
and adding it manually, it might be that it downloads needed packages when you add it to be downloaded from maven repository and that's when the issue came up.
Anyways, the solution at these situations might be using the latest version:
implementation 'commons-validator:commons-validator:1.6'
Or, exclude it as follows:
implementation ('commons-validator:commons-validator:1.5.0') {
exclude group: 'commons-logging', module: 'commons-logging'
}
Note: The following part can't be helpful (for this issue) since the error says:
Commons-logging defines classes that conflict with classes now provided by Android
You could go deeply by running ./gradlew app:dependencies
in the IDE terminal to see which one conflicts with the Android itself and then excluding it as above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With