I have the following bulid.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.onlinecomments.android"
minSdkVersion 14
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
//The below is the one that is failing
compile 'com.github.rahatarmanahmed:circularprogressview:2.3.2'
}
I did the "Sync Now" that shows on the page and I did "Tools -> Android -> Sync Project With Gradle Files" and both failed to import the library, so when I do "Alt + Enter" on the below I don't get the "Import class"
CircularProgressView cpb;
So what I did next is that I created a test android project and the import was successful, anyone had this issue and made it work?
Please note that the program compiles just fine without the last library I noted above.
Situations like this I make the following, then look for an answer :-) :
Make sure gradle is not set to work offline.
Clean & Build.
Remove then re-add the dependency.
Also if it's like you said that it works in another project, your last resort is to make a new project and re-add the sources.
Related
I'm running the application in Android 5.1 device and it's running well after some time i have uninstalled the android studio and now i have installed Android Studio 3.0.1 and working on Elementary OS Loki and trying to run it on Android 8.0 device and when I start new app and run it then all goes well but the existing project is not running it gives error while running
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException:
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
And I have build.gradle file as below
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "za.co.neilson.alarm"
multiDexEnabled true
minSdkVersion 16
targetSdkVersion 26
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:26.0.0'
implementation files('lib/android-support-v7-appcompat.jar')
}
I have googled and tried other solutions like
multiDexEnabled true
And rebuild / clean project but it did not work
Since you are using compile 'com.android.support:appcompat-v7:26.0.0' there are no reasons to add the jar file (also pay attention since the aar contains the jar file but also the resources).
Remove this line:
implementation files('lib/android-support-v7-appcompat.jar')
and delete the lib/android-support-v7-appcompat.jar file
I have googled and tried other solutions like
multiDexEnabled true
It is completely useless in your case. Use it when your app and the libraries it references exceed 65,536 methods, not when you are adding twice the same classes.
Try to change your gradle version to 3.0.1 or 2.3.3. By changing to one of them it may work for you.
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
//or try classpath 'com.android.tools.build:gradle:2.3.3'
}
After this clean and rebuild the project.
Hope it helps you.
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
I want to build an Android App with AndroidAnnotations.
Here is a simplified version on GitHub which fails to build/pre-process: https://github.com/aiQon/androidannotationsexample
The app is composed of a main app module and a library module.
Both use AndroidAnnotations (AA). The lib module has a workaround to find the AndroidManifest.xml in debug builds (it refers to the release manifest, because gradle does not build the debug variant for libs).
However, the manifest is found for the library module but not for the main app.
The gradle file of the main app is:
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
android {
compileSdkVersion 21
buildToolsVersion "21.0.1"
defaultConfig {
applicationId "de.stelle_beratung.androidannotationslibraryexample"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
apt {
arguments {
androidManifestFile variant.outputs.processResources.manifestFile
resourcePackageName android.defaultConfig.applicationId
}
}
dependencies {
compile project(":mylibrary")
apt "org.androidannotations:androidannotations:3.2+"
compile 'org.androidannotations:androidannotations-api:3.2+'
}
Gradle complains with:
http://pastebin.com/QZtnHcZD
Could someone please point me in the right direction on how to build this simplified project to have a controller Bean in the lib module and reference it successfully in the main app activity by using AA?
I appreciate any help.
Since android gradle plugin 14.4, the following line does not work anymore:
variant.outputs.processResources.manifestFile orvariant.processResources.manifestFile
You have to use this one instead:
variant.outputs[0].processResources.manifestFile
Please note if you have multiple outputs (when using splits), you may want to use another output (other index than zero).
Ok I got it. Was using Android Studio from the Canary Channel. Going back to Beta solved the issue because I could use android gradle plugin 0.12.2. This solved everything.
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.
I recently just switched to Android Studio 0.6.1 for app dev and I ran into an issue with gradle.
I get "Error:(1, 0) Plugin with id 'android' not found. I am quite new so any help would be appreciated.
Here is my build.gradle file:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.b3dog.helloagain"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
this issue appears in my android studio 0.6.1 canary build so after a week struggling i found whats wrong with new studio version . its not about Gradle as far as i see . and it happen to some people and you know why ? because some people specially junior developer accidentally proceeding in way that this error occur just after create new project . problem came from name of your activity let me explain it to your step by step
now , when u create new project , wizard appear and here's your step :
first :
you enter application name
second :
select your minimum sdk
third :
type of your activity
forth :
your activity name
here's the point . if you choose the system default"my activity
error will occur but if you change it to your own custom name such as "myListactivity" or any other custom One . this error will no longer exist .
Mostly it is because of that project sync error.
In android studio, please try that click "tools" ->"Android"-> "sync project with gradles files."