my eclipse project error when migrated to android studio? - android

this my problem over day, my log result is Error:(2) Attribute "titleTextStyle" has already been defined
my project use actionbarsherlock, google_play_service, and another lib, i want to move my old project to android studio. i already tried many link in this site but doesn't work. this my gradle.
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.ltvie.test"
minSdkVersion 9
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile project(':lib')
compile 'com.android.support:support-v4:20.0.0'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.code.gson:gson:2.1'
compile 'com.google.guava:guava:11.0.1'
compile 'com.google.protobuf:protobuf-java:2.2.0'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.android.support:support-v4:18.0.0'
compile files('libs/google-api-client-1.10.3-beta.jar')
compile files('libs/google-api-client-android2-1.10.3-beta.jar')
compile files('libs/google-http-client-1.10.3-beta.jar')
compile files('libs/google-http-client-android2-1.10.3-beta.jar')
compile files('libs/google-oauth-client-1.10.1-beta.jar')
compile files('libs/jackson-core-asl-1.9.4.jar')
compile files('libs/json-org.jar')
compile files('libs/jsr305-1.3.9.jar')
compile files('libs/universal-image-loader-1.9.3-SNAPSHOT.jar')
compile files('libs/WebSocket.jar')
}
i read some tutorial that my problem cause I use appcompat-v7 and actionbarsherlock in same time, but in my dependencies nothing appcompat-v7, i try to remove actionbarsherlock then the error disappear but appear more error. how to solve my problem, thanks.

Related

All android support libraries must use the same version specification

I dont know where I went wrong, but this keeps me saying
All com.android.support libraries must use the same exact version specification (mixing versions can lead to runtime crashes.) Found versions 24.0.0,23.2.0 Examples include com.android.support:animated-vector-drawable:24.0.0 and com.android.support:cardview-v7:23.2.0
my build.gradle is
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.example.project"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.android.support:cardview-v7:23.2.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mani:ThinDownloadManager:1.2.2'
compile 'net.rdrei.android.dirchooser:library:3.2#aar'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.onesignal:OneSignal:3.+#aar'
}
apply plugin: 'com.google.gms.google-services'
It shows error in this line too
compile 'com.android.support:appcompat-v7:23.2.0'
I tried changing compileSdkVersion to 24 too, but nothing seems to work as of now. Actually everything was working fine before I introduced the play services library.
This dependency is using version 24.0.0 of com.android.support:animated-vector-drawable:
compile 'com.google.android.gms:play-services:10.2.0'
which will cause android studio to complain that it could lead to bugs/crashes because versions of all your google libraries don't match.
So you have 2 options: (that I know of off the top of my head)
Change your compileSdkVersion to 24 and change all your support library dependencies to version 24 as well to match the play-services dependencies:
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
Downgrade com.google.android.gms:play-services to 9.4 or 9.2.1 so that it doesn't use version 24 of anything. This still requires a minor change to your support libraries from 23.2.0 to simply 23.0.0
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.android.support:cardview-v7:23.0.0'
compile 'com.google.android.gms:play-services:9.4.0'

Android studio getting crashed when gradle is build on mac

I am working on android studio from one year But i can't face this type of problem. What i am doing is adding a dependency of support library in app build.gradle and then sync the project.
Gradle build running is started in background and then after some time studio is automatically crashed. There is no error or logs are found for crashes. And if I removed the dependency from gradle it works properly. I also restarted the machine and having an latest update of studio but it can't fixed the problem. Thanks in advance for any help.
Here is my app level build.gradle file. I am adding compile 'com.android.support:design:22.2.0' library in my project
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId ""
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.isseiaoki:simplecropview:1.0.9'
compile "com.mixpanel.android:mixpanel-android:4.8.0"
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.10.1'
}
apply plugin: 'com.google.gms.google-services'

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

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.

android studio does not syncing any github library

It's been 3 days that I can't use any library in github , I used to work with most of them but now it doesn't work at all .
it takes about 5 minutes and then I get a message like this :
Error:(30, 13) Failed to resolve: jp.wasabeef:recyclerview-animators:1.3.0
Show in File<br>Show in Project Structure dialog
here is my gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.xx.xx"
minSdkVersion 11
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile files('libs/acra-4.5.0.jar')
compile files('libs/universal-image-loader-1.8.4-with-sources.jar')
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:cardview-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile files('libs/org.apache.http.legacy.jar')
compile 'com.soundcloud.android:android-crop:1.0.1#aar'
compile 'jp.wasabeef:recyclerview-animators:1.2.2'
compile 'com.android.support:design:23.0.0'
compile 'jp.wasabeef:recyclerview-animators:1.3.0'
}
How can I solve this bothering problem ?
I think Because you are using 2 versions of same library. Use one of them and then build the project.
compile 'jp.wasabeef:recyclerview-animators:1.2.2'
and
compile 'jp.wasabeef:recyclerview-animators:1.3.0'
If you are using a RecyclerView 23.0.1 or below. (As this lib document)
dependencies {
compile 'jp.wasabeef:recyclerview-animators:1.3.0'
}
Hope this will help you. Thanks...

TransformException after migrating to Android Studio

I tried to import a working Eclipse Android project to Android Studio. I am working on Mac with the latest version of Android Studio. When I try to build, it keeps on displaying this error:
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/google/api/client/http/AbstractHttpContent.class
The class generating this issue is in the com.google.http-client:google-http-client-gson:1.20.0 library, in the com.google.api.client.http package. I tried many things with the app.gradle file, such as excluding the com.google.api.client.http group but nothing works. Here is my app.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example.time2"
minSdkVersion 17
targetSdkVersion 19
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions.encoding = 'ISO-8859-1'
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:20.0.0'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.http-client:google-http-client-gson:1.20.0'
compile 'com.google.code.gson:gson:2.1'
compile files('libs/commons-io-2.4.jar')
compile files('libs/google-api-client-1.18.0-rc.jar')
compile files('libs/google-api-client-android-1.18.0-rc.jar')
compile files('libs/google-http-client-1.18.0-rc.jar')
compile files('libs/google-http-client-android-1.18.0-rc.jar')
compile files('libs/google-oauth-client-1.18.0-rc.jar')
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.3.6.jar')
compile files('libs/json-simple-1.1.1.jar')
compile files('libs/jsr305-1.3.9.jar')
compile 'com.stripe:stripe-android:+'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
}
You should avoid manually adding in libs to your project.
E.g. change
compile files('libs/commons-io-2.4.jar')
compile files('libs/google-api-client-1.18.0-rc.jar')
compile files('libs/google-api-client-android-1.18.0-rc.jar')
compile files('libs/google-http-client-1.18.0-rc.jar')
compile files('libs/google-http-client-android-1.18.0-rc.jar')
compile files('libs/google-oauth-client-1.18.0-rc.jar')
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.3.6.jar')
compile files('libs/json-simple-1.1.1.jar')
compile files('libs/jsr305-1.3.9.jar')
to
compile 'commons-io:commons-io:2.4'
compile 'com.google.api-client:google-api-client:1.18.0-rc'
compile 'com.google.api-client:google-api-client-android:1.18.0-rc'
compile 'com.google.http-client:google-http-client:1.18.0-rc'
compile 'com.google.http-client:google-http-client-android:1.18.0-rc'
compile 'com.google.oauth-client:google-oauth-client:1.18.0-rc'
compile 'org.apache.httpcomponents:httpcore:4.3.3'
compile 'org.apache.httpcomponents:httpmime:4.3.6'
compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'com.google.code.findbugs:jsr305:1.3.9'
Please verify that these are the correct packages. Let us know what you find after updating?
The library 'com.google.http-client:google-http-client-gson:1.20.0' is composed of the following nine modules:
google-http-client
google-http-client-android
google-http-client-appengine
google-http-client-xml
google-http-client-protobuf
google-http-client-jdo
google-http-client-jackson
google-http-client-jackson2
google-http-client-gson
Some of these e.g. google-http-client is included again in tour dependencies as a jar. Hence the duplicate entry.
Check this link for getting the setup right when using google-http-java-client. It has step by step instruction - Setup Instructions

Categories

Resources