Unable to build project in Android Studio - android

I imported a project into Android Studio from Eclipse. It was building successfully in Eclipse.
At the end of importing process I got this error:
Gradle project sync failed. Basic functionality will not work
In the Gradle console I get the following error:
Error:Failed to find: com.android.support:appcompat-v7:20.+
I have already installed google support repository as mentioned in other places.
This is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "21.0.0"
defaultConfig {
applicationId "com.entujn.demo"
minSdkVersion 10
targetSdkVersion 19
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.txt'
}
}
}
dependencies {
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:appcompat-v7:20.+'
compile files('libs/commons-lang3-3.3.2.jar')
}
local.properties:
sdk.dir=/home/pankaj/adt-bundle-linux-x86_64-20140702/sdk
SDK directory structure screenshot
Looks like the appcompat stuff is not present at the right place, how do I fix it ?

Looks like Android Studio uses another copy of SDK, which does not have Android Support repository installed. Please make sure it has all needed components installed.

Related

Error with Android Studio while using Facebook Audience Network

I have tried to put Facebook ads in my application, which is earlier works with Google Admob ads. But while adding this line in my gradle file makes errors. compile 'com.facebook.android:audience-network-sdk:4.+'. I have also tried with the specified versions. But same errors.
Main error is
can't resolve Symbol R
I also tried clean, rebuild and Sync Project with Gradle file. But no response.
I have updated my Google play services, and Google Respirotory.
Here is my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 15
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.myapp.application"
minSdkVersion 15
targetSdkVersion 15
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':businessApp')
compile 'com.facebook.android:audience-network-sdk:4.+'
}
I can successfully build the gradle if I remove this line
compile 'com.facebook.android:audience-network-sdk:4.+'
There is no other errors in My app. If I need to change anything in Android studio to use Facebook Audience Network, or any other requirements?
After adding this dependency , sync your project and then click on Build-->Clean Project

Gradle error while importing library

I have many problem with import module in android studio.
The first time when i tried to import module , gradle said : target sdk not found.
Then i installed target sdk , gradle said target platform-tools not found. And these errors not solving with installing sdk and platform-tools.
I have these errors while try to import sherlockactionbar and many else library.
gradle version : 2.8
Please tell me how to solve this problem.
build.gradle of my app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "a.x.e.h.myapplication"
minSdkVersion 19
targetSdkVersion 20
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 project(':mylibrary')
compile project(':actionbarsherlock')
compile project(':actionbarsherlock-fest')
compile project(':actionbarsherlock-i18n')
}
error when i added dependency module:
Error:failed to find Build Tools revision 17.0.0
Install Build Tools 17.0.0 and sync project
May be you are using a build tool not existing in your installation.
Open your SDK Manager and download the latest Build Tools (23.0.2).
Update your build.gradle files (in your app and in your modules).
To do it change this line:
buildToolsVersion "20.0.0"
with
buildToolsVersion "23.0.2"
You should check your Project Structure and put the correct Path to the Android SDK.
Error:failed to find Build Tools revision 17.0.0
Install Build Tools 17.0.0 and sync project
I've solved the same problem with simply clicking on link above ( Install Build Tools 17.0.0 and sync project), Android Studio automatically downloaded Build Tools revision 17.0.0 and all now is working correctly.

Unable to add Minim-Android library in Android Studio with jitpack

I am trying to add to my build.gradle file in Android Studio the following dependency:
https://android-arsenal.com/details/1/1883
I followed the intstructions found in package tab of this page, but when I tried to build the project I got the following message:
Error:(32, 13) Failed to resolve:
com.github.DASAR:Minim-Android:a73b596916
Anyone can help me?
I also tried to download the project code and import it in Android Studio as a module, but it wasn't recognized as a library from the wizard.
Thank you all in advance.
You can download relative API in your AS SDK Manager, then add it in build.gradle. After that, check out the compileSdkVersion, targetSdkVersion are same with appcompat. My build.gradle is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "21.0.1"
defaultConfig {
applicationId "com.example.android"
minSdkVersion 9
targetSdkVersion 19
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:19.0.0'
}
my sdk is 19
Best option is to fork the project and add a Gradle build file. Then use JitPack to build the fork.
Note that the project has dependencies in a libs/ folder so these would need to be converted to dependencies in Gradle.

Failed to find: com.android.support:support-v4:22.2.0

I am trying to do an application but there seems to be some error with the gradle files now. It was working fine until I upgraded the support libraries.
I was working with api 21 which worked fine, but then i upgraded to api22 and changed the gradle files accordingly.. Now this error shows up.
Error:Failed to find: com.android.support:support-v4:22.2.0
This is my current gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.sampleapp"
minSdkVersion 12
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.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.jakewharton:butterknife:6.1.0'
}
Any help would be appreciated.
If this might help someone, after MANY trials and errors, I found that I was targeting the wrong SDK version (an older one) in the build.gradle file corresponding to "library". To change this you can do it by hand or go to the Module Settings Menu (right click on your project folder -> Open Module Settings. Then in "library" - Properties you can change the Compile Sdk and the Build Tools Versions
Using Android SDK Manager. Go to Extras and then Android Support Repository and update it to the latest version.
(This is essentially the comment #natario made, but it should be an answer.)

Upgraded Android Studio - Project no longer builds gradle build tools version

I have just upgraded my Android Studio but when I try to build/compile the project, I get the following error:
`Error:Execution failed for task ':libraries:facebook:preBuild'.
Build Tools Revision 19.0.0+ is required.`
My gradle looks like this:
Dependencies
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
Android
compileSdkVersion 19
buildToolsVersion "19.0.3"
SDK Manager:
As you can see, I have installed pretty much every Android SDK Build-tools version. yet still, the error persists.
Any ideas?
Update
Dependies - which is at the bottom of the gradle file:
dependencies {
compile 'com.android.support:support-v4:18.0.+'
compile 'com.google.maps.android:android-maps-utils:+'
compile project(':libraries:facebook')
compile 'com.google.android.gms:play-services:3.2.25'
compile files('libs/TestFlightLib.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/libGoogleAnalyticsServices.jar')
compile files('libs/svg-android.jar')
}
I tried changing the support version to 19.0.+ but it still didn't work.
I was looking in the wrong Gradle. The error specified that the error is coming from the "Facebook" gradle and not the gradle which belongs to the app. Each library has it's own gradle. So, the facebook's gradle's builTolsVersion was 18.0.0 instead of 19.0.0.
Duh!
Have you tried right-clicking your project-> Android Tools->Add Support Library-> select Android Support Library, revision 19, click on Accept Licence and Install.
Try to invalidate caches / restart , it fixed this like this after updated AS.
File-> Invalidate caches/restart -> Invalidate And restart.
The file <YourProject>/app/build.graddle should be changed to match version of the files you have in the SDK Manager (green icon of the robot with arrow pointing down - just under Help menu). You have two options:
1) download the version you need (in SDK Manager) for which Android Studio shows links to click on them to download proper version)
2) modify the file above to match version(s) of the files you have in your SDK Manager (ie probably version numbers matching your updated-to-latest-greatest-version)
Then rebuild your project.
The way I fix this problem was by pasting the code, into the android of your graddle file
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

Categories

Resources