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."
Related
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.
Motivation:
I am doing project and making an app in which after login I need to switch to Navigation Drawer Activity. But whenever I was adding a Navigation Drawer in my project the activity_navigation was always showing a rendering problem.
Problem:
After many hours I tried to make a new project, and then added only "Navigation Drawer Activity" the problem was still there in Rendering.
ScreenShot:
This is what i am getting by creating a new project having a simple "Navigation Drawer Activity".
This Rendering Problem only exists in main_navigation.xml and not in fragment_navigation.xml and fragment_navigation_drawer.xml
Check List:
Please note that
- Android Support Repository
- Android Support Library
ALL are added.
Help:
There are many solutions available on siteS, blogs and even stackoverflow saying to change the build.graddle file and so on. I tried many solutions but couldn't find a satisfactory one. Please Help me in that regard.
I'm having the same problem with Android Studio 1.2 and I've tried a lot of things but any of them works
For me the solution was to use the Canary Channel and update Android Studio to 1.3.
Now I have this version and it works perfect but this is not and stable version
My build.grade is in this way
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.androidtest.materialdesign"
minSdkVersion 15
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'
}
This is the problem with Android Studio 1.2
and the same code with Android 1.3 is this
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 have seen the question already asked in Can't find ScriptC_saturation in BasicRenderScript Sample
but as I am new in RenderScript, I can make it out they have already done much, so I cannot find the question as low level as I am asking:
I am using Eclipse Juno and have imported the BasicRenderScriptSample.
I am using the android.support.v8.renderscript (
(eclipse) project properties:
renderscript.target=18
renderscript.support.mode=true
sdk.buildtools=19.0.3
When I was not sure why the ScriptC_saturation is not auto generated, I was stuck till I followed the answer below, and copied the .rc file in the necessary folder, and everything compiled well.
Update:
Setup the necessary gradle properties as below (using jcenter rather than mavencentral):
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-L'
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.android.basicrenderscript"
minSdkVersion 'L'
targetSdkVersion 'L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:18.0.+"
}
On Compilation I get this error in emulator and device all alike (from eclipse as well):
RenderScript﹕ bcc compiler terminated unexpectedly
RenderScript﹕ bcc: FAILS to prepare executable for 'saturation'
What could be the reason?
update 2: My Eclipse version of this project, somehow ran after series of cleaning, on the device (less than L) properly, but Gradle version project runs with THE error everywhere.
Don't put the .rs file in your res/ folders. It is a source file, not a resource. It dynamically creates .bc files which do end up automatically in your res/raw folder.
I followed the instructions at this link to create a simple mobile/wearable app in Android Studio. However, upon trying to run it I am getting the error "Failure [INSTALL_FAILED_OLDER_SDK]". My problem seems to be like the one asked at this link, however unlike that user the reddit post that is linked to didn't contain any information that helped me (it basically suggested to add < uses-sdk tools:node="replace" /> to the android manifest, but android studio didn't like the tools thing." My build.gradle files are exactly the same as those at the above link. I just updated Android Studio today (0.8.2) and have installed all necessary SDK's. Many people are getting this error but mine is unique in that I'm targeting the Wear stuff and not concerned with Android L. Any input is appreciated. Thanks!
I believe I have the answer here. Basically instead of deploying to the phone like the instructions say to, you have to enable bluetooth debugging and deploy directly to the watch.
Do those changes in build.gradle file in the wear module
compileSdkVersion 20
targetSdkVersion 20
So the final wear/build.gradle content will be:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "your package name"
minSdkVersion 20
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
}