running into android studio issue Could not GET exoplayer - android

I have been running into this error while trying to build my app and do not know how to resolve it, when I toggle Gradle offline mode, the error disappears but other dependency requires it to be turned off.
Could not GET 'https://google.bintray.com/exoplayer/com/google/gms/google-services/4.3.4/google-services-4.3.4.pom'. Received status code 502 from server: Bad Gateway
Disable Gradle 'offline mode' and sync project
This is my build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.6.1'
classpath 'com.android.tools.build:gradle:4.2.1'
classpath 'com.google.gms:google-services:4.3.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "https://jitpack.io" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my second buid.gradle
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.9'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
android {
signingConfigs {
release {
storeFile file('C:\\Users\\Osas Divine\\Desktop\\sckoolite\\unilorin-sckoolboy.jks')
storePassword '123456/'
keyAlias 'key0'
keyPassword '123456/'
}
}
compileSdkVersion 29
defaultConfig {
applicationId "com.sckoolboy.unilorin"
manifestPlaceholders = [onesignal_app_id: "d0989000-9ff3-4214-a42b-ed8f5a123456",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
minSdkVersion 19
targetSdkVersion 29
versionCode 11020
versionName '5.2.2'
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
archivesBaseName = "Sckoolboy"
useLibrary 'org.apache.http.legacy'
signingConfig signingConfigs.release
}
dexOptions {
jumboMode true
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
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
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.github.vivchar:ViewPagerIndicator:1.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.7.2'
implementation 'com.squareup.retrofit2:converter-gson:2.7.2'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.squareup.okhttp3:logging-interceptor:4.4.1'
..........
implementation('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'
// google maps library ------------------------------------------------------------------------
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation('com.google.android.libraries.places:places:1.0.0') {
exclude module: 'glide'
}
}
apply plugin: 'com.google.gms.google-services'

Related

How to fix the "Android MPAndroidChart Could not find method dependencyResolutionManagement() for arguments error in gradle"?

well Im trying to use MPAndroidChart library in Android studio
my gradle version was 7.0.2 but it didnt work well.
so i changed gradle Version to 6.7.1, and Android Gradle Plugin Version to 4.2.2
i also changed the version of sdk to Android 11.0(R)
my Target SDK version is 30
--build.gradle(project)
// Top-level build file where you can add configuration options common to all sub-
projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.2"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects{
repositories{
google()
mavenCentral()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
--build.gradle(Module)
plugins {
id 'com.android.application'
}
android {
compileSdk 31
BuildToolsVersion '30.0.3'
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 23
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories{
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}
--setting.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
}
rootProject.name = "My Application"
include ':app'
--capture of the bug
enter image description here
--bug code
Settings file 'C:\Users\kimta\AndroidStudioProjects\MyApplication\settings.gradle' line: 1
A problem occurred evaluating settings 'MyApplication'.
Could not find method dependencyResolutionManagement() for arguments [settings_5pc4jcjs87c9dkfx5manehm0u$_run_closure1#69c68d91] on settings 'MyApplication' of type org.gradle.initialization.DefaultSettings.
gradle problem is too difficult for novice like me. Is there any solution ?
You try to add this line in your settings.gradle:
maven { url 'https://jitpack.io' }
--setting.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven { url 'https://jitpack.io' } //Add this line in your settings.gradle
}
}
rootProject.name = "My Application"
include ':app'
--build.gradle(project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
--build.gradle(Module)
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.myapplication"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.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'
// MPAndroidChart
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}

firebase-perf make gradle takes more than 7 mins every time run the app, Android studio 3.6.2

UPDATE:
I commented firebase-perf codes and now it runs faster !
Any advice please ?
OLD:
Android studio 3.6.2 take more than 7 mins to run the app every time,
tried clean and invalidate and restart Android studio
also modified gradle.properties as
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx2048m
org.gradle.parallel=true
org.gradle.configureondemand=true
I think it was good before adding firebase-perf SDK
Module:app
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.31.2'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
def keystorePropertiesFile = rootProject.file('keystore.properties')
// Initialize a new Properties() object called keystoreProperties.
def keystoreProperties = new Properties()
// Load your keystore.properties file into the keystoreProperties object.
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.app"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
debuggable true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
productFlavors {
}
}
dependencies {
//noinspection GradleCompatible
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1#aar') {
transitive = true
}
implementation 'com.google.firebase:firebase-analytics:17.2.3'
implementation 'com.google.firebase:firebase-messaging:20.1.1'
implementation 'com.google.firebase:firebase-auth:19.2.0'// Authentication
implementation 'com.google.firebase:firebase-database:19.2.1'// Realtime Database
implementation 'com.google.firebase:firebase-perf:19.0.5'
implementation 'com.facebook.android:facebook-android-sdk:4.38.1'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.firebase:firebase-ads:19.0.1' // ads
implementation 'androidx.room:room-runtime:2.0.0'
annotationProcessor 'androidx.room:room-compiler:2.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
//noinspection LifecycleAnnotationProcessorWithJava8
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
}
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.6.1'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:perf-plugin:1.3.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Could not GET 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom'

Getting error while using Add Firebase Authentication to your App in the Firebase authentication (Assistant).
The error shows in the Sync tab as:
Could not GET 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom'. Received status code 405 from server: Method Not Allowed
Enable Gradle 'offline mode' and sync project
My Android Studio Details are:
Android Studio version 3.2.1
Gradle version: 4.6
build.gradle (Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/android/android-tools' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.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
}
build.gradle (App)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.nsc.suyog.myotp1"
minSdkVersion 21
targetSdkVersion 27
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:27.1.1'
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
}
Try to change the following code (project):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
maven { url "http://jcenter.bintray.com"}
maven { url 'https://dl.bintray.com/android/android-tools' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
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()
maven { url "http://jcenter.bintray.com"}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And (app):
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.nsc.suyog.myotp1"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
android { lintOptions { abortOnError false }
aaptOptions {
cruncherEnabled = false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-auth:16.1.0'
}
Also in gradle-wrapper.properties add this line or change if already exist with other value:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
Just remove :15.0.0 from the firebase implementation!
The implementation should be like:
implementation 'com.google.firebase:firebase-auth:16.1.0'
Else every thing seems fine!

Failed to resolve: com.android.support:palette-v7:26.0.1

I am having this error on Android Studio:
Error:Failed to resolve: com.android.support:palette-v7:26.0.1
Install Repository and sync project
Open File
Show in Project Structure dialog
When I click 'Install Repository and sync project' nothing happens.
I already checked and tried similar questions's answers. But still problem exists.
Here is my project level build.gradle code:
// 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:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
maven {
url "https://jitpack.io"
}
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here is my app level build.gradle code:
apply plugin: 'com.android.application'
apply from: "$rootDir/utils.gradle"
apply plugin: 'io.fabric'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
//repositories {
// maven { url 'https://maven.fabric.io/public' }
//}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
maven { url 'https://maven.fabric.io/public' }
}
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
def applicationName = "xyz"
defaultConfig {
applicationId "xyz"
minSdkVersion 15
targetSdkVersion 26
versionCode 16
versionName "1.7"
manifestPlaceholders = [onesignal_app_id : "xyz",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildConfigField 'String', 'END_POINT', toJavaCodeString(END_POINT)
}
signingConfigs {
debug {
keyAlias 'androiddebugkey'
keyPassword 'android'
storePassword 'android'
storeFile file('../keystore/debug.jks')
}
release {
keyAlias 'xyz'
keyPassword 'xyz'
storePassword 'xyz'
storeFile file('../../../Keystore/xyz.keystore')
}
}
productFlavors {
dev {
signingConfig signingConfigs.debug
versionCode defaultConfig.versionCode
versionName defaultConfig.versionName
applicationId "xyz"
}
prod {
signingConfig signingConfigs.release
versionCode defaultConfig.versionCode
versionName defaultConfig.versionName
applicationId "xyz"
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig getSigningConfig()
applicationVariants.all { variant ->
variant.outputs.each { output ->
def date = new Date();
def formattedDate = date.format('dd-MM - HH:mm:ss')
output.outputFile = new File(output.outputFile.parent,
output.outputFile.name.replace("app-prod-release", applicationName + " v" + defaultConfig.versionName + " - " + formattedDate)
)
}
}
}
debug {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), "rules-proguard-debug.pro"
signingConfig signingConfigs.debug
}
}
lintOptions {
abortOnError false
}
}
ext {
supportLibraryVersion = "26.0.1"
}
repositories {
mavenCentral()
jcenter()
maven {
url "https://jitpack.io"
}
maven {
url "https://maven.google.com"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "com.android.support:appcompat-v7:${supportLibraryVersion}"
compile "com.android.support:design:${supportLibraryVersion}"
compile "com.android.support:palette-v7:${supportLibraryVersion}"
compile "com.android.support:recyclerview-v7:${supportLibraryVersion}"
compile "com.android.support:cardview-v7:${supportLibraryVersion}"
compile "com.android.support:customtabs:${supportLibraryVersion}"
// compile "com.android.support:support-dynamic-animation:${supportLibraryVersion}"
compile 'com.tsengvn:typekit:1.0.1'
compile 'com.jakewharton.timber:timber:4.5.0'
compile 'com.mikepenz:iconics-core:2.8.2#aar'
compile 'com.mikepenz:fontawesome-typeface:4.7.0.0#aar'
compile 'com.mikepenz:community-material-typeface:1.7.22.1#aar'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'pub.devrel:easypermissions:0.2.1'
compile('com.github.ozodrukh:CircularReveal:2.0.1#aar') {
transitive = true;
}
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup:otto:1.3.8'
compile 'com.balysv:material-ripple:1.0.2'
testCompile 'junit:junit:4.12'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile 'me.zhanghai.android.materialprogressbar:library:1.3.0'
compile 'com.inthecheesefactory.thecheeselibrary:adjustable-imageview:1.0.0'
compile 'com.github.florent37:viewanimator:1.0.5'
compile 'com.github.ybq:Android-SpinKit:1.1.0'
// compile 'com.google.android.gms:play-services-ads:11.0.4'
compile 'com.afollestad.material-dialogs:core:0.9.4.7'
compile 'com.afollestad.material-dialogs:commons:0.9.4.7'
// compile 'com.onesignal:OneSignal:3.+#aar'
// compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile 'com.onesignal:OneSignal:[3.6.2, 3.99.99]'
def gmsVersion = '11.2.+'
compile("com.google.android.gms:play-services-gcm:${gmsVersion}") {
force = true
}
compile("com.google.android.gms:play-services-location:${gmsVersion}") {
force = true
}
compile("com.android.support:support-v4:${supportLibraryVersion}") {
force = true
}
compile("com.android.support:support-v13:${supportLibraryVersion}") {
force = true
}
compile("com.android.support:customtabs:${supportLibraryVersion}") {
force = true
}
compile 'com.google.android.gms:play-services-ads:' + gmsVersion
compile 'com.anjlab.android.iab.v3:library:1.0.+'
// compile 'org.solovyev.android:checkout:1.0.0'
// debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
// releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
// testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
}
Project and app level build.gradle code added.
Any idea? Thanks!
This is the best way to do it.
In your root level gradle.build use below
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and in your gradle-wrapper.properties file change the wrapper version as below
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip
also in your app level build.gradle make sure you are using 26 vesion as below
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.xxxx"
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'
}
}
}

Proguard doesn't build project with duplicate classes

I have one flavor for specific device. For this device I have .jar file which have custom android sdk(for this device. It contains some custom class which I have to use). And it works fine until I start use proguard. When I build project with proguard I receive this:
...
Note: there were 1504 duplicate class definitions.
...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:proguardAppProguard'.
> java.io.IOException: Please correct the above warnings first.
I found that adding a string:
-ignorewarnings
to proguard-android.txt fixes this problem, but it looks like bad solution. Did somebody face this(or similar) problem?
Edit
build.gradle:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'android-apt'
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
flatDir {
dirs 'libs'
}
}
apply plugin: 'idea'
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
configurations {
provided
}
sourceSets {
main {
compileClasspath += configurations.provided
runtimeClasspath += configurations.provided
}
}
def computeVersionName() {
return "r_1.0"
}
android {
compileSdkVersion 23
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.app"
multiDexEnabled true
String buildSuf = System.getenv("BUILD_NUMBER");
ext.defaultName = project.archivesBaseName;
if (buildSuf != null) {
def vers = Integer.parseInt(buildSuf)
println "VERCODE = ${vers}"
versionCode vers
} else {
versionCode 1000
}
minSdkVersion 16
targetSdkVersion 21
}
productFlavors {
app {
applicationId "com.app"
versionName computeVersionName()
}
}
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
disable 'InvalidPackage'
}
signingConfigs {
...
customerProgurd {
storeFile file('../keys/debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
...
}
buildTypes {
...
customerProguard {
debuggable false
jniDebuggable false
minifyEnabled true
proguardFiles rootProject.file('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.customerProgurd
}
...
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
dependencies {
...
app files('libs/classes.jar') // it's custom sdk
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
...
}

Categories

Resources