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
Related
I am currently going through a ConstraintLayout tutorial and stuck in a specific step (https://codelabs.developers.google.com/codelabs/constraint-layout/#10).
The source is here (https://github.com/googlecodelabs/constraint-layout).
Per instructions below, it says to add a vertical barrier but I do not see the add option in the menu. Actually the entire menu options look different. Where is the "Add Vertical barrier" menu?
Right click on ConstraintLayout in the blueprint or the Component
Tree. You will see the Add Vertical barrier and Add Horizontal barrier
options.
I am running Android 2.3.3.
build.gradle (Module: app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.google.googleio"
minSdkVersion 22
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.1.0-beta1'
}
I am running Android 2.3.3.
I am going to guess that you mean that you are running Android Studio 2.3.3. In that case, there is no such menu. That is added in Android Studio 3.0, available in beta from today.
Add this line to your gradle (Module:app)
implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta1'
Verdant newbie here. I'm making a fairly simple project that needs to be compatible with Android versions older than Lollipop, but still want to have the app look nicer by using AppCompat.
Unfortunately, I do not know how to work (or even find) the gradle - I tried to run a gradle task: compile "com.android.support:appcompat-v7:21.0.+"
But it returned an error saying that "Task 'compile' is ambiguous...." in my project.
Could anyone tell me how to add this? I've searched all over Google, but everything goes way over my head.
Thanks!
Have you been able to locate Gradle file?
Edit your gradle like this :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.xyz.xyz"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.00.00"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
}
Update your question and post full Gradle code.
Add the appcomapt library(com.android.support:appcompat-v7:21.0.+") in dependancy section of the build.gradle file
Or second way to add library is by searching on maven repo.this can be done by traversing file->project structure->app>dependancy->click (+) ->add Library dependancy
Task 'compile' is ambiguous.
This issue is not the Compile Issue. but this was an issue on the task itself.
if you are not using a command like "gradle compileDebug" then one of the android configurations are executing the task and it is not working well with your build.gradle.
Here is a link that seems to relate specifically to your issue. Click Here
I'm trying to implement data-binding in android app. This is the link I'm following to set it up. Even after doing all the necessary implements, I'm getting the following error in gradle-build:
error: package com.example.satpracticeapp.databinding does not exist.
(This package is what I'm importing in my MainActivity.java file)
I tried this (the data-binding compiler), but it didn't work.
The problem is I've already successfully tried a hello-world app using data-binding and it works. But, when I try to implement it in an app I made a few weeks ago, I get the error I mentioned above. Searching for the solutions, I copy-pasted the gradle files from my successful hello world app to my old app - that too didn't work out.
Here is my app level build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.satpracticeapp"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.0'
}
And here's the buildscript of the project level build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
Here are the links to the minimal version of the three files (if it's needed)
MainActivity.java
ViewModel.java
activity_main.xml
After much hair-pulling, I couldn't figure out the solution and getting the same build error again and again.
So, as a temporary solution, I'm trying to copy-paste my classes and layouts in the working hello world project. What am I missing?
EDIT:
After a few hours of pointless searching, I went back to my code. Checked it word by word and found a typing mistake at the name of a binding variable in the xml file.
Everything works fine now!
I had the same issue, turned out to be a duplicate symbol declaration in one of my *.java classes. It's shown in the Gradle console but it was kinda hidden among the databinding errors. i had about 72 data binding errors and this duplicate symbol error was in the middle so it's easy to miss.
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:+'
}
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."