Error building in Android Studio - android

I am new to Android Studio. But after updating my Android Studio to the latest version everything works fine, but when I decide to run the app I get this error:
(Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
java.io.FileNotFoundException: C:\Users\collinluvpc.gradle\caches\2.14.1\classAnalysis\cache.properties (The system cannot find the file specified))
I have tried to invalidate cache and restart but nothing seems to work. Please help.

At first Upgrade SDK Manager .
(Error:Execution failed for task ':app:compileDebugJavaWithJavac'. java.io.FileNotFoundException: C:\Users\collinluvpc.gradle\caches\2.14.1\classAnalysis\cache.properties (The system cannot find the file specified))
This exception is thrown during a failed attempt to open the file denoted by a specified pathname.
What is your classpath ??
You can use
compile 'com.google.android.gms:play-services:current_version'
& Use this
classpath 'com.android.tools.build:gradle:current_version'
Then Clean-Rebuild Your Project .

Go to File > Settings > Build Tools > Gradle > Configure "Gradle User Home to" -> user/.android/.gradle

Related

Sync project in android studio failed

I'm totally new in android programming and by now just trying to run a "Hello World" program! But I couldn't! This is what I've done till now:
Previously I had android-studio-ide-171.4443003-windows installed on my laptop, and I installed all SDK Tools from SDK manager. But every time I wanted to sync a project it end up with this error:
ERROR: Could not find com.android.tools.build:gradle:3.5.0. Searched
in the following locations:
- file:/C:/Users/Pro/.android/manual-offline-m2/android-gradle-plugin-3.5.0-beta01/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom
- file:/C:/Users/Pro/.android/manual-offline-m2/android-gradle-plugin-3.5.0-beta01/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.jar
- file:/C:/Users/Pro/.android/manual-offline-m2/gmaven_stable/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom
- file:/C:/Users/Pro/.android/manual-offline-m2/gmaven_stable/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.jar
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.jar
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.jar
Required by:
project : Open File
then I updated my android studio to android-studio-ide-191.5791312-windows32, and again it get that error! so I download android-gradle-plugin-3.5.0-beta01 and gmaven_stable from android developer site and as the site said, I extracted them and copy the content into [my home directory]\.android\manual-offline-m2. and then restart android studio, but the problem still exist!
Then I went to Settings > Build, Execution, Deployment > Gradle and checked the "Offline work" and specified the "Service directory path" as "[my home directory]/.android/manual-offline-m2/android-gradle-plugin-3.5.0-beta01" and again tried to sync the project, but sync got new error:
ERROR: No cached version of com.android.tools.build:gradle:3.5.0 available
for offline mode.
now I'm totally confused and don't know what should I do to solve this problem! If anybody help me I will really appreciate that.
Open android studio go to your project -> build.gradle -> edit this code
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}
Try lowering your build.gradle version to classpath 'com.android.tools.build:gradle:3.4.2'
I think your android studio does not support that kind of classpath version.

Jenkins: Ionic android build failed

I am beginner of ionic mobile development and now I am setting CI for my mobile application using Jenkins (on localhost). I am facing an error that I am unable to resolve for many days. ionic compiles successfully but at the last at the time of android build preparation it fails and gives error I mentioned below.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.0.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.0.0.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> corphttpsproxyhost.yourdomain: Name or service not known
> Could not resolve com.android.tools.build:gradle:3.0.0.
> Could not get resource 'https://maven.google.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Could not GET 'https://maven.google.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> corphttpsproxyhost.yourdomain
Please let me know where I am committing mistake, or is there any other dependency issue.
Thanks
I think you did not add gradle 3.0.0
You can do this by going to “Configure System” (Jenkins 1.x) or to “Global Tool Configuration” (Jenkins 2.x). From the home page navigate to:
Manage Jenkins -> Configure System (Jenkins 1.x)
Manage Jenkins -> Global Tool Configuration (Jenkins 2.x)
Scroll down a little bit and you should encounter a small section for gradle with a single button labeled “Gradle installations…”. Click on that button to expand the configuration panel.
The gradle configuration panel will ask for a few parameters. Here you can set the tool to a static path, or let Jenkins handle the installation for you. We recommend using “Install automatically” for ease of use. Below is an example of an automatic installation of gradle 3.0.0
than you have to select this gradle version from your project configration.
in bbuild tab
add Invoke Gradle script
Invoke Gradle
X Gradle Version 3.0.0
than build it it may help you

Error:Execution failed for task ':app:mergeDebugResources'. > Error: java.io.FileNotFoundException:

Error: java.io.FileNotFoundException: \app\build\intermediates\res\merged\debug\drawable-mdpi-v4\abc_ic_star_black_48dp.png (The requested operation cannot be performed on a file with a user-mapped section open)
trying to build project but file name changes all the time, error remain same
Just open this(app\build\intermediates\res\merged\debug\drawable-mdpi-v4\abc_ic_star_black_48dp.png) file directory and delete it.
Clean and Re-build your project.
Hope this will help you.
The Android Gradle plugin version 2.2.2 has an issue.
To resolve this issue you need to change your gradle plugin version in project setting:
classpath 'com.android.tools.build:gradle:2.1.3'
Just delete build folder in app then clean & rebuild project that works fine.

Updated android and gradle now getting error "Execution failed for task ':app:compileDebugJavaWithJavac'

I just updated android studio and the gradle, but now when i try running the app i get the following error:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not open local jar classpath snapshot write cache (C:\Users\Richi\Documents\Android Studio Project\AppMaster\.gradle\2.14.1\tasks\_app_compileDebugJavaWithJavac\localJarClasspathSnapshot).
> Unexpected lock protocol found in lock file. Expected 3, found 0.
not sure whats going on!!
Delete the .gradle folder and restart android studio.

Unable to run andorid app in android studio

Starting the android studio gives this error
Error:Execution failed for task ':app:prepareComAndroidSupportAppcompatV72220Library'.
Could not expand ZIP '/home/abskpr/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.aar'.
Please help!!!
It's a build error; Go to File -> Settings -> Build -> Gradle and select Use default Gradle wrapper (Recommended)

Categories

Resources