Error:Cannot configure the 'publishing' extension after it has been accessed - android

Error:Cannot configure the 'publishing' extension after it has been accessed.
I am getting this error after updating my android studio.
this is my app.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
generatedDensities = []
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/universal-image-loader-1.9.5.jar')
compile project(':databaseAutoCompleteLibrary')
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.support:gridlayout-v7:23.2.0'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile 'milyn:opencsv:1.6'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile project(':MPChartLib')
compile project(':filechooserlibrary')
//compile 'com.android.support:support-v4:18.0.0'
//compile 'com.android.support:appcompat-v7:18.0.+'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:support-v13:23.2.0'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile project(':Volley')
compile 'com.google.android.gms:play-services:8.4.0'
}
please provide any solution.
I am using volley library.
Thanks.

I have faced the same issue after upgrading to latest studio.
I am not sure about the root cause but what I did is
comment below line from volley build.gradle
apply from: 'bintray.gradle'
As I can see there many project are there in you dependencies.
If possible comment same from all and try syncing again.

Same thing happened to me.
I am not a Gradle expert but my solution was a little bit less drastic. I just edited the bintray.gradle file by moving the line:
apply plugin: 'maven-publish'
just before the publishing action.
This problem seems to be related with this:
https://github.com/researchgate/gradle-release/issues/125

This error comes from volley module, I solved this problem by doing as follows:
open volley module, find bintray.gradle file and change
publishing {
publications {...}
}
to
publishing.publications {...}
then it will work just fine.

I got this now when I introduced a circular dependency among modules inadvertently, in case some one hits it in the future.

Related

duplicate entry of library gradle causing application not run

I searched alot but not found any solution of my problem, i tried to run my app on any device and i got this error:
it's throwing an error with com.github.bumptech.glide:glide:3.5.2 ,but it's used only single time how the classes of it got duplicate i run this app before with the same dependencies with out any trouble but suddenly this error appear while i run the app.
app.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "info.androidhive.firebase"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.android.support:design:25.1.0'
compile 'com.firebaseui:firebase-ui-database:1.1.1'
compile 'com.firebaseui:firebase-ui-storage:1.1.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.github.bumptech.glide:glide:3.5.2'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.crystal:crystalrangeseekbar:1.1.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Browse to your project's "libs" directory and remove redundant "glide.x.x" which is causing the error due to redundancy.
Try putting this line :
enforceUniquePackageName false
after buildtoolVersion in your gradle

Android Studio dex.DexException:

Randomly got this error during my build (debug or production) in the morning.
com.android.dex.DexException: Multiple dex files define Lcom/crashlytics/android/answers/shim/R
Execution failed for task ':app:transformClassesWithDexForDebug'.
>...
It has been 10hours and I have tried:
1) Updated my Android SDKs
2) Updated my Google Repository
3) Updated everything else as well.
4) Cleaned and Rebuild the project with no errors.
5) Went through my external dependency tree, didn't find any duplicate libraries.
Here is my gradle content:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "######.####"
minSdkVersion 19
targetSdkVersion 25
versionCode 53
versionName "1.2"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.androidmapsextensions:android-maps-extensions:2.3.0'
compile 'com.google.android.gms:play-services-gcm:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-places:10.2.1'
compile 'com.google.maps.android:android-maps-utils:0.5'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'org.jsoup:jsoup:1.9.2'
compile 'com.github.lzyzsd:circleprogress:1.1.0#aar'
compile 'com.google.code.gson:gson:2.7'
compile 'io.branch.sdk.android:library:2.+'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-crash:10.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:1.0.1'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.edmodo:rangebar:1.0.0'
compile 'com.appyvet:materialrangebar:1.3'
compile 'com.facebook.fresco:fresco:0.14.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
compile 'com.android.support:recyclerview-v7:25.0.0'
}
apply plugin: 'com.google.gms.google-services'
Running out of ideas and google result pages for a solution. Does anybody experienced find something wrong with the libraries I use or the versions?
Thanks!
remove this line = compile 'com.android.support:design:25.0.0'
if it doesn't work please add
dexOptions {
preDexLibraries = false }
to your build.gradle file
Solution found.
Looking at the error I googled and found this.
Then went to the Branch documentation and found this here which stated:
Note that if you don’t plan to use the Fabric Answers integration, you
can use the following line:
compile ('io.branch.sdk.android:library:2.+') {
exclude module: 'answers-shim'
}
This answers-shim is also in the stacktrace.
I wonder where is that module then duplicated?

How can I resolve this build error when adding facebook sdk

I keep getting the BUILD FAILED in Android studio and I have resolved other similar error before but this one is hard. Basically what i do is adding the quickstart-android-auth to an existing working Android project.
Everything worked until i adding the quickstart-android-auth files and independents.
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library
[com.facebook.android:facebook-android-sdk:4.16.0]
D:\AndroidStudioProjects\Nogget\app\build\intermediates\exploded-aar\com.facebook.android\facebook-android-sdk\4.16.0\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.facebook" to force usage
And here is my Build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.2'
dexOptions {
dexInProcess = true
}
defaultConfig {
applicationId "com.port.android"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
mavenCentral()
}
packagingOptions{
exclude 'META-INF/LICENSE'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:support-compat:24.2.0'
compile 'com.google.android.gms:play-services:9.6.0'
compile 'com.android.support:support-v13:24.2.0'
compile "com.google.firebase:firebase-messaging:9.0.0"
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.google.code.gson:gson:2.4'
compile 'com.android.support:design:24.2.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:percent:24.2.0'
compile 'me.grantland:autofittextview:0.2.+'
compile 'com.google.firebase:firebase-auth:9.2.1'
compile 'com.google.firebase:firebase-messaging:9.2.1'
compile 'com.google.android.gms:play-services-appinvite:9.6.0'
compile 'com.google.firebase:firebase-analytics:9.2.1'
compile 'com.google.firebase:firebase-crash:9.6.0'
compile 'com.google.android.gms:play-services-ads:9.6.0'
compile 'com.github.bmelnychuk:atv:1.2.+'
compile 'com.github.johnkil.print:print:1.2.2'
testCompile 'junit:junit:4.12'
compile 'com.seatgeek:placesautocomplete:0.2-SNAPSHOT'
compile 'com.fasterxml.jackson.core:jackson-core:2.7.2'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.2'
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.2'
compile 'com.facebook.android:facebook-android-sdk:4.16.0'
compile('com.twitter.sdk.android:twitter-core:1.6.6#aar') {
transitive = true
}
compile('com.twitter.sdk.android:twitter:1.13.1#aar') {
transitive = true;
}
}
apply plugin: 'com.google.gms.google-services'
As the error says, your minSDK is 14 but the latest FacebookSDK requires mins SDK 15. Increasing your minSDK should resolve your issue
Change your minSdkVersion to 15 instead of 14.
The Facebook library require api 15. So your project can't have a minsdkversion to 14...
Set the minSdk in your build.gradle to 15 as facebook supports from API 15.

While adding any new dependencies in android build.gradle file. it always show an error

Error:(42, 13) Failed to resolve: com.android.volley:volley:1.0.0
When add any dependencies in android build.gradle file it always shows the above error. But same project is running on a different machine same dependencies can add successful. I search lot for solving this problem but can't find any solution. Kindly Please help me to fix the problem Thank you.
I face the same error while adding any dependencies now, but few weeks before i can add any dependencies on my project
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "myappid"
minSdkVersion 17
targetSdkVersion 24
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter({url "http://jcenter.bintray.com/"})
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:support-vector-drawable:24.0.0'
// VectorDrawableCompat
compile 'com.android.support:animated-vector-drawable:24.0.0'
compile 'com.android.support:support-annotations:24.0.0'
compile 'com.satsuware.lib:usefulviews:2.3.6'
compile 'com.github.ganfra:material-spinner:1.1.1'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
compile 'com.ramotion.foldingcell:folding-cell:1.0.1'
compile 'com.android.volley:volley:1.0.0'
}
I try many way to solve the problem i have faced but no one can rectify the problem. I ask the help of may experience developer, they told me that they never face such a problem in there life. So only solution i found is to reinstall android studio. Now it work perfectly. Any way thanks for your support.

No class found exception com.squareup.okhttp.logging.HttpLoggingInterceptor

Even after adding the dependencies and importing the class I am getting java.lang.NoClassDefFoundError: com.squareup.okhttp.logging.HttpLoggingInterceptor.
Can anyone please help?
Gradle Build file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "xyz"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
mavenCentral()
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.okhttp:logging-interceptor:2.6.0'
}
In my case, I found that the versions of the okhttp3 and okhttp3:logging-interceptor dependencies needed to exactly match. So for example:
...
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
...
Could be a compatibility problem with retrofit.
Try with :
implementation 'com.squareup.okhttp:logging-interceptor:2.5.0'
This post could be help
App crash on HttpLoggingInterceptor
Also it can be connected with multidex true option in your build.gradle (yes, seems like some devices have problems with multidex apps (read, Samsung))
If this is your case, switch this flag off and rebuild your project. Consider using
minifyEnabled true
shrinkResources true
to reduce your apk size. If it is still too large, that's really weird and bad news, but there are some techniques to put your apk on diet.

Categories

Resources