I am trying to create a new sample app in Android Studio 2.0. When I try to Run or debug it shows a compile time error like,
Execution failed for task ':app:compileDebugJavaWithJavac'.
java.io.FileNotFoundException: D:\Android Studio\newapp\app\libs\core.jar (The system cannot find the file specified)
I had tried by giving path JAVA_HOME C:\Program Files\Java\jdk1.7.0_45 and
Sync project with gradle.
This is My Gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'
...
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1-alpha2'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.0.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'com.google.android.gms:play-services:+'
compile 'org.apache.httpcomponents:httpclient:4.2.6'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile files('libs/core.jar')
}
Even after that I cant find any solution.
Thank You in advance
libs\core.jar (The system cannot find the file specified)
Seems like an obvious error to me...
Remove this line. You don't need it
compile files('libs/core.jar')
You could add a core.jar file into the libs folder, but you still wouldn't need that line since you are already compiling it
Also, pick only one version, please. You don't need to add them multiple times
compile 'com.android.support:appcompat-v7:23.0.1-alpha2'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:appcompat-v7:23.2.0'
Same for these
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:design:23.0.1'
Related
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/android/volley/AuthFailureError.class
and this is my gradle build file:
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.android.support:appcompat-v7:25.3.1'
//compile 'com.facebook.android:facebook-android-sdk:4.14.0'
compile project(path: ':linkedin-sdk')
// compile 'com.mcxiaoke.volley:library-aar:1.0.0'
// compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.paolorotolo:expandableheightlistview:1.0.0'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:support-core-utils:25.3.1'
compile 'com.google.android.gms:play-services-maps:9.0.1'
compile 'com.google.android.gms:play-services-location:9.0.1'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:25.1.1'
compile 'com.android.support:cardview-v7:25.1.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
testCompile 'junit:junit:4.12'
}
The app works fine with the new version of the API.
But it has the problem with older versions of the API.
You seem to be confused about how to get Volley in your app
// compile 'com.android.volley:volley:1.0.0'
// compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
Those last two are deprecated. The first line is correct.
https://developer.android.com/training/volley/index.html
And you need to remove any Volley related files from the libs directory, plus make sure LinkedIn library also isn't using volley
I don't see why you need it though when you have Okhttp for http calls and Glide and Picasso for image loading
Related errors will arise from mixing 25.3.1, 23.0.1, 23.1.1, and 25.1.1 support libraries. Those all need to be the exact same
multiDexEnabled true
Add above line into your build.gradle file in defaultConfig like this:
defaultConfig{
multiDexEnabled true
}
You can test putting this on root of directory in the Terminal
./gradlew clean
I am using android studio, while trying to use HttpPost,HttpClient it says cannot find symbol. i surfed on internet and found that if we are at api level 23 we need to add some dependence so i added.
useLibrary 'org.apache.http.legacy'
and
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
}
in my build.gradle file. but even after adding this the same problem exist.
any other solution.
If you are having problem with dependency then download the jar from the following link and add it to your libs folder. Then right click on that jar then select Add as Library.
https://hc.apache.org/downloads.cgi
I have a problem when trying to compile exoplayer r1.5.2 repository.... There's no issue when I use com.google.android.exoplayer:exoplayer:r1.4.2 instead.
Here's of the compilation code:
And then this error is thrown:
I had this issue as well: I added compile 'com.google.android.exoplayer:exoplayer:r1.5.2' to my app/build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.google.android.exoplayer:exoplayer:r1.5.2'
}
And tried sync project in Android Studio, but got the error above.
Solution
I got the dependency downloaded by upgrading to gradle 2.6 and invoking gradle from the shell:
$ ./gradlew build
Upgrading Gradle
Edit the distributionUrl line in <project dir>/gradle/wrapper/gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
I just launched a project in Android Studio 0.8.1 for the first time since upgrading from 0.6.2.
The error thrown is "Error:Module version com.android.support:support-v13:19.1.0 depends on libraries but is not a library itself".
Does anyone have an idea why this is? I have installed some of the new API20 stuff to play with Android L, but the buildTools for this project are still set to 19.1.0.
Here's the dependencies section of my build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.1.+'
compile 'com.android.support:support-v13:19.1.+'
compile 'com.jakewharton:butterknife:5.1.0'
compile 'de.greenrobot:eventbus:2.2.1'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.mcxiaoke.viewpagerindicator:library:2.4.1'
compile 'uk.co.chrisjenx:calligraphy:0.7.+'
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.google.android.gms:play-services:4.4.+'
}
SDK/Buildtools settings are as follows:
compileSdkVersion 19
buildToolsVersion "19.1.0"
Can anyone explain this or point me towards a fix? I'm stumped.
It looks like the support-v13:19.1.0 might have incorrect metadata. Try switching to
compile 'com.android.support:support-v13:20.0.0' and see if your problem persists?
Earlier this week Android Studio started randomly deleting dependencies from my build.gradle file whenever I create a new file.
Is there a particular order that's expected?
My dependencies section looks like this:
dependencies {
compile project(':ParallaxScroll')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:4.+'
compile 'com.android.support:support-v4:19.+'
compile 'com.android.support:support-v13:19.+'
compile 'com.android.support:appcompat-v7:19.+'
compile group: 'com.squareup.picasso', name: 'picasso', version: '2.2.0'
compile group: 'com.squareup.retrofit', name: 'retrofit', version: '1.4.1'
compile 'com.github.gabrielemariotti.cards:library:1.5.0'
compile 'com.viewpagerindicator:library:2.4.1#aar'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.crashlytics.android:crashlytics:1.+'
}
When I create a new activity in the project it ends up looking like this (this happens every time):
dependencies {
compile project(':ParallaxScroll')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'com.squareup.picasso', name: 'picasso', version: '2.2.0'
compile group: 'com.squareup.retrofit', name: 'retrofit', version: '1.4.1'
compile 'com.google.android.gms:play-services:4.+'
compile 'com.android.support:support-v4:19.+'
compile 'com.android.support:support-v13:19.+'
compile 'com.android.support:appcompat-v7:19.+'
}
It took a little while to figure out what was happening.
Which of the two compile formats I'm using is correct? Is this potentially causing issues? It wasn't an issue until this week.
I can of course restore my dependencies but this doesn't explain why AS is deleting things all the time.
I'm also concerned about both support libraries being included. As far as I know I'm using only v4 stuff. Is using both bad practice?
This is a bug that will be fixed in 0.5.9. You can track it here:
https://code.google.com/p/android/issues/detail?id=60749
In the meantime, as a workaround, just create new activities by hand, or save off the contents of the build file before creating them through the wizard.