This is a new installation for Android studio 2.3.3 on windows 10 64bit machine, android failed execution for first project, never worked, I tried all solutions here, delete cache, rebuild, clear project, reinstall Android, reinstall Java, environment variables, not using embedded JDK, changing project path what ever solution never worked with this error:
Error:Execution failed for task ':app:processDebugManifest'.
com.android.manifmerger.ManifestMerger2$MergeFailureException: java.io.FileNotFoundException: C:\Users\myAccount.android\build-cache\6460e35c08ce39c08eb2823bfce76d67a31dcb77\output\AndroidManifest.xml (The system cannot find the file specified)
Gradle Module
Gradle Project
Just delete 'C:\Users\myAccount.android\build-cache\6460e35c08ce39c08eb2823bfce76d67a31dcb77', and rebuild your project. Android Studio will recreate this folder.
Try below code in build.gradle file and rebuild project again;
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.user.packagename"
minSdkVersion 16
targetSdkVersion 25
versionCode 25
versionName "2.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/NOTICE' // will not include NOTICE file
exclude 'META-INF/LICENSE' // will not include LICENSE file
exclude 'META-INF/DEPENDENCIES' // will not include LICENSE file
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
Thank you guys, you helped me alot solve this issue
Here is what happened, i traced that error , Android studio cannot find the file AndroidManifest.xml in the cash output folder, and actually it wasn't there, next step i deleted everything in the folder: C:\Users\myAccount.android\build-cache, and gave permission to the .Android folder, and deleted all old projects, cearte new project and the AndroidManifest.xml is there, now im checking my app on my Samsung device, i revert all modification to default settings for Android Studio, and it is still fine , what i think is the deleting all file in cash solved the issue, i already did it before but may be it is multiple problem like missing SDK that i have installed ... thank you all hopefully somebody benefit from this
Moving project files to ntfs drive fixed it.
Strangely enough, also moving my files from an exFAT drive to an NTFS one seemed to work
you need to check for your minSDK if its not installed then you need to first installed the proper SDKs,and then everything worked fine.hope it will work for you.
I've always programmed Android with Eclipse and decided to start migrating to Android Studio. I decided to use the same SDK I already had for Eclipse, then:
Started a new project
Set minimum SDK 4.0 (API Level 14)
Choose Blank Activity option
Used Default names for Activity Name and Layout Name
Hit Finish
After a few seconds Gradle finishes the build, and it throws me two errors with the following messages in file Teste4\app\build\intermediates/exploded-aar\com.android.support\appcompat-v7\23.0.0\res\values-v23\values-v23.xml:
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Under File -> Project Structure -> Modules: app (left column) -> Properties tab, I have the following versions set up:
"Compile Sdk Version": Android 5.1 (API Level 22)
"Build Tools Version": 23.0.2
What should I do in order to fix this?
I already tried what was suggested in Stack Overflow question appcompat-v7:21.0.0': No resource found that matches the given name: attr 'android:actionModeShareDrawable', but it didn't work.
Your compile SDK version must match the support library's major version.
Since you are using version 23 of the support library, you need to compile against version 23 of the Android SDK.
Alternatively you can continue compiling against version 22 of the Android SDK by switching to the latest support library v22.
This happens because after updates Android Studio uses API version 23 by default.
The following worked for me:
Press Ctrl + Shift + Alt + S to get to the project structure page. Go to the properties tab and change 23.0.0 to 22.0.1 (or equivalent to what you were using earlier) in the build tool area and rebuild your project.
If that doesn't work, go to gradle:app and then
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
Edit v7:23.0.0 to v7:22.2.1 as shown above and sync gradle. This will definitely work.
When you update your Android Studio, it uses API version 23 by default,
which is the main reason for its occurrence. So,
At first, check your AppCompat version in build.gradle(Module:app)
That is,
If after changing to 23 there occurs an error then just download
Compile Sdk Version to API 23, and Build Tools Version to 23.0.0
from SDK Manager. If already downloaded then:
1. Go to SDK Manager and
2. Under Project Structure, change *Compile SDK Version* to API 23, and *Build Tools Version* to 23.0.0
Click the SDK Manager Button and open the dialog.
Click SDK Platform and check if Android 6.0 is downloaded or not.
if not, then download that first. After completing the download, click Apply.
Now you need to apply changes to your project from setting.
Then press Ctrl + Alt + Shift + S to open setting
Click the app from the list.
Click properties
Change your Compile SDK Version to API 23
Change your Build Tools Version to 23.0.0
Don't forget to rebuild your project.
Then your error will be gone.
If you've tried to change target to a previous GooglePlayServices or AppCompatv7 version and it doesn't work, check if you have any project-libraries dependency, this project will be targeting the latest version of any of these libraries. It happened to me with the Google Maps Utils Library project:
replace:
compile 'com.google.android.gms:play-services:+'
to
compile 'com.google.android.gms:play-services:8.3.0'
Then you can continue full targeting API 22
If it still doesn't compile, sometimes is useful to set compileSdkVersion API to 23 and targetSdkVersion to 22.
I agree with the previous answer. Your compile SDK version must match the support library. Here is what I did.
You can go to SDK Manager and under SDK Platform, install the Android 5.X with API level 23.
Under Project Structure, change compile SDK Version to API 23, and Build Tools Version to 23.0.0
Then it should build without problem.
You need to set compileSdkVersion to 23.
Since API 23 Android removed the deprecated Apache Http packages, so if you use them for server requests, you'll need to add useLibrary 'org.apache.http.legacy' to build.gradle as stated in this link:
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
...
//only if you use Apache packages
useLibrary 'org.apache.http.legacy'
}
This issue is raised because now the compile SDK version must match the Android Support library's major version.
In my case i have the Android Support Library version 23, so i had to compile against the Android SDK version 23, and I had to change this in my build.gradle file:
Well some of you will need to install the SDK, Android 6.0 (API 23)
and donĀ“t forget to Sync project with gradle files
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId ""
minSdkVersion 14
targetSdkVersion 22
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.google.code.gson:gson:2.3.1'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.1'
}
I found the solution, Problem started when I updated sdk, after that I used different buildToolsVersion ('22.0.1') and I was using different support library like compile 'com.android.support:appcompat-v7:23.0.0', showing you in image below
This was raising problem of "android.widget.Material..."
Then I used same version for support library like compile 'com.android.support:appcompat-v7:22.0.1' and its DONE. (Showing you in below screenshot)
You should compile your project with latest version so update & install from your SDK. Sync your project with sync project with Gradle file Button.
You can also continue with the existing version but check it installed properly below image indicate to API 22 that is properly installed.
And sync your project if needed.
it may help.
As pointed out by Tanis.7x, the support library version (23) does not match the targetSdkVersion (22)
You can fix this by doing the following:
In the build.grade file of your app module, change the following line of code
compile 'com.android.support:appcompat-v7:23.0.0'
To
compile 'com.android.support:appcompat-v7:22.+'
This will use the latest version of the appcompat version that is compatible with SdkVersion 22.
Your compile SDK version must match the support library major version. This is the solution to your problem. You can check it easily in your Gradle Scripts in build.gradle file.
Fx: if your compileSdkVersion is 23 your compile library must start at 23.
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 340
versionName "3.4.0"
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
}
And always check that your Android Studoi has the supported API Level. You can check it in your Android SDK, like this:
In my case it was an higher version of Google-play-services. I set them to 7.0.0 (not 8.x) and all was ok.
I wanted to downgrade from API 23 to 22 and got this error. I had to change all build.gradle files in a project in order to compile.
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.yourapp.app"
minSdkVersion 14
targetSdkVersion 22
}
...
dependencies {
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
}
This is what helped me: Adding specific android platform
What should be done is the following... In my case it was cordova but the same is relevant for ionic, phonegap and other frameworks like these:
list all platforms installed for your project: cordova platform list. You'll see something like this:
remove the android platform: cordova platform remove android.
then add the specific android platform: cordova platform add android#5.0.0.
Good luck! :)
I got the same problems. I solved my problem by updating gradle.build for each sub-module to latest compiler version.
Another solution :
navigate to
\sdk\extras\android\m2repository\com\android\support\appcompat-v7\23.x.x
open .aar file with 7-zip or winrar , in res folder remove values-23 folder and save changes .
on module: app (Gradle)
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.namepack.nameappxxxxx"
minSdkVersion 16
targetSdkVersion 21
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:21.0.3'
}
project: nameAppXXXX (Gradle)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
and edit your activity of AppCompatActivity to for example Activity:
package com.namepack.nameappxxxxx;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
public class NameClass extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity);
}
}
Everything is great but none of you explained where to download the SDK build tools
Make sure that all these are in upto date.
Upgrade Android Studio.
I had this issue with Android Studio 1.3.1 and none of the other answers worked for me, but after updating to 1.5.1 there were no problems.
If you are using phonegap(cross-platform) and got same issue above,
just remove the android platform using below command.
phonegap platform remove android
And add it again.
phonegap platform add android
Then problem solved for me.
If you are getting errors even after downloading the newest SDK and Android Studio, here is what I did:
Download the most recent SDK
Open file-Project structure (Ctrl + Alt + Shift + S)
In modules, select app
In the properties tab: Change compile SDK version to API 23 Android 6.0 marshmallow (latest)
I hope it helps someone so that he won't suffer like I did for these couple of days.
As others have already mentioned your compile sdk version must match your support library's major version. This is however, also relevant for subprojects should you have any.
In case you do, you can set your subprojects compile sdk versions with the following script:
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
Add this script in your root build.gradle file.
This seems to be a popular problem with Android: I have a precompiled .so file that I would like to access via the JNI, but I cannot get Android Studio (in my case version 1.5) to build the project in a way that makes this file accessible. Like the other people asking this question, I hit an UnsatisfiedLinkError when calling System.loadLibrary():
static {
System.loadLibrary("NativeLib");
}
There are several questions like this one on StackOverflow, and the solutions appear to focus on two techniques, neither of which work for me:
Creating a main/jniLibs directory: Several people say that if you create a folder called /app/src/main/jniLibs and within that a folder for your target (I tried all of armeabi, armeabi-v7, and arm64-v8a), Android Studio will find the library. See also This question. If I do this, the native call in my java code remains highlighted in red with tooltip text, 'Cannot resolve corresponding JNI function Java_my_function_etc'. The tooltip reference is identical to my method call, which I generated with the javah utility.
Modifying build.gradle Another proposed solution is to point to the location of the .so file by making a modification to build.gradle. In my case, I tried setting jniLibs.srcDirs to /src/main/jniLibs, and 'jniLibs' while the .so file in question was located in /app/src/main/jniLibs/armeabi, /app/src/main/jniLibs/armeabi-v7a, and /app/src/main/jniLibs/arm64-v8a. My gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.my.application"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jniLibs.srcDirs = ['jniLibs']
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile files('libs/commons-lang3-3.1.jar')
}
A third technique which appears to have emerged from a Google Groups posting in 2013 involves packaging the .so files into a jar and including the jar file in the project. I unzipped my APK file and found that the .so files are included in ./lib/armeabi, ./lib/armeabli-v7a, and ./lib/arm64-v8a. I didn't try this technique because it seems obsolete, and unnecessary since my .so files are making it into the APK.
I'm out of things to try. Is there any other technique for including a native .so in an Android Studio project? Is there anything I could have overlooked in the above two techniques? Has Android Studio changed in some critical way since the linked questions were answered?
I program with Android Studio.
Error message:
Error:Execution failed for task ':app:dexRelease'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_25\bin\java.exe'' finished with non-zero exit value 2
And my build.grandle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "theToolcome.theTool.theTool"
minSdkVersion 15
targetSdkVersion 22
versionCode 4
versionName "1.1"
}
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:22.0.0'
compile 'com.google.android.gms:play-services-analytics:7.3.0'
}
I didn't change anything, I only added the Google analytics. What's my problem? I search also on the stackoverflow, but nothing worked for me.
I also imported the project again, but nothing helped me.
For everyone reading.
The problem was that he downloaded a sample from the internet that contained anaylitics jar file, and he also told Android Studio to compile it for him via compile 'com.google.android.gms:play-services-analytics:7.3.0' so the end effect was that there were two libraries with mostly the same classes and that failed the build.
As the official documentation states out, your applications method references have exceeded the maximum limit:
Note: If the number of method references in your app exceeds the 65K limit, your app may fail to compile. You may be able to mitigate this problem when compiling your app by specifying only the specific Google Play services APIs your app uses, instead of all of them. For information on how to do this, see Selectively compiling APIs into your executable.
Instead of importing the entire Google Play Services, you should import the part that you use.
So instead of compile 'com.google.android.gms:play-services-analytics:7.3.0' you could use compile 'com.google.android.gms:play-services-maps:7.3.0', if what you want is GoogleMap API.
Check the Analytical Table and select the part that you want, then import it and you should be fine.
Project structure > JDK Location > Change it to a 1.7 version of the jdk.
In your message log you can scroll down to errors there can you see what the error is and maybe you can solve it at yourself. Otherwise one of the forum members can maybe help if you send the error.
Long story short I have decided to play around with the new Google wearable stuff, so I opened up android studio and clicked the import from sample project. (mind you it does not matter what project I chose to import and have tried many of them)
I open the project and Everything is wrong because Android studio can't find the wearable imports... BUT it CAN build it to the watch just fine. So basically if I type
mApiClient = new GoogleApiClient.Builder(this);
The GoogleApiClient is made red because it "Cannot find the object"
import com.google.android.gms.common.ConnectionResult; <-- cannot find symbol common
import com.google.android.gms.common.api.GoogleApiClient; <-- cannot find symbol common
import com.google.android.gms.common.api.ResultCallback; <-- cannot find symbol common
import com.google.android.gms.wearable.MessageApi; <-- cannot find symbol MessageApi
import com.google.android.gms.wearable.MessageEvent; <-- cannot find MessageEvent
import com.google.android.gms.wearable.Node; <-- Cannot find Node
import com.google.android.gms.wearable.NodeApi; <-- Cannot find NodeApi
import com.google.android.gms.wearable.Wearable; <-- Cannot find Wearable
Now mind you... All of this builds... It just renders the editor useless due to the fact that it gives me no code assistance and is always telling me there are 100s of errors in the project. It is worse then notepad!
Things I have tried:
Uninstalling and reinstalling Android Studio (3 times now)
Uninstalling and reinstalling ALL of the android SDK's and extra
tools
Clicking the button to Sync Project with Gradle (1000s of times)
Checking all Gradle files for the right packages (again, these are
the sample code and it does build... so it has to be getting the
right stuff...)
Threatening my PC with installing Hackintosh on it and then burning
it. (at least 6 times now)
I have tried looking around but so far have not found anything that fixed it. any help would be much appreciated.
Thanks
EDIT:
(Delayed Application wearable sample code!)
gradle files:
Module Application:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
}
dependencies {
compile "com.android.support:support-v4:21.0.2"
compile "com.android.support:support-v13:21.0.2"
compile "com.android.support:cardview-v7:21.0.2"
compile 'com.google.android.gms:play-services-wearable:6.5.+'
compile 'com.android.support:support-v13:21.0.+'
wearApp project(':Wearable')
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 18
targetSdkVersion 21
}
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
}
Module: Wearable
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'com.android.application'
dependencies {
compile 'com.google.android.gms:play-services-wearable:6.5.+'
compile 'com.android.support:support-v13:21.0.+'
compile 'com.google.android.support:wearable:1.1.+'
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
}
Hope this helps! hopefully I'm missing something stupid. On my mac I was able to import the sample code and run it (on my windows I can run it... just editing is going to be terrible.)
Sounds like it could just be a problem with your settings file somehow being corrupted. I would try reseting android studio to a default state.
See this question for steps - How to reset Android Studio