I know this question is asked many times, and i used all the Answers to to resolve my error. Here is my problem.
I tried almost all Answer present on So, so please before mark my question as Duplicate, please read my question care, i mentioned all steps that are answered on SO Questions.
Whenever i tried to run / build / clean project i got error * What went wrong:
Task 'stacktrace' not found in root project 'project'.
Library and Sdk i m using
ViewPagerIndicator - JakeWharton
Facebook SDK
PDK (Pinterest sdk)
gcm.jar
httpcore-4.4.4.jar
What i have tried so far
changed Gradle version from 2.2.1-all.zip to lower version
changes Gradle Build version
delete all Library and run
All library project minSdkVersion same (my project using minSdkVersion: 11 )
clean project and Rebuild
Invalidate cache and restart Android Studio
delete .idea and .gradle folder then Import project
Created new project and copy paste old Project into project but it also gives same error on build
deleted .gradle folder from user folder(i m using windows 7 )
try to build project using command line
Changed JDK version new jdk1.8.0_73 ( my project was build on jdk1.7.0_55 ) here is thread that said using new JDK version will resolve problem
here are Answers i follwed first solution , Second solution, third solution Fourth Answer and many more.
Temporary solution(it was working before but not now )
i have backup of project two week ago, i import that backup project and replace the files and it works
But when i do clean project error came again
here is app level build.gradle file
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "XXX"
minSdkVersion 11
targetSdkVersion 23
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile project(':library')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/jsoup-1.8.3.jar')
compile files('libs/httpcore-4.4.4.jar')
compile 'com.google.android.gms:play-services:8.3.0'
compile files('libs/gcm.jar')
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
}
android {
useLibrary 'org.apache.http.legacy'
}
Here is proejct level builld.gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:1.5.0-beta2'
}
}
allprojects {
repositories {
jcenter()
}
}
Help will be Appreciated!. Please share your ideas to resolve this error
i m trying to deal with error from 1 week and i m not getting answer from anywhere that will work for me
thanks
Related
The Android studio ask me to update the gradle version to 4.4 and gradle build tool version to 3.1.2.
After the update, The whole android studio shows red lines in file, when I hover my cursor on these error it says "cannot resolve symbol" but compiles with no error i.e., build is successful.Click here to see red lines in java files
and Here are the gradle app and project files.
//Build.gradle(project)
//Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven {
url 'https://maven.fabric.io/public'
}
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.2.0'
classpath 'io.fabric.tools:gradle:1.25.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url 'https://maven.google.com/'
}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and
//build.gradle(module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.developers.paras.droidwatch"
minSdkVersion 19
targetSdkVersion 27
versionCode 9
versionName "9.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
android.defaultConfig.vectorDrawables.useSupportLibrary = true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support:customtabs:27.1.1'
compile 'com.android.support.constraint:constraint-layout:1.1.0'
compile 'com.android.support:design:27.1.1'
compile 'com.android.support:support-v4:27.1.1'
compile 'com.google.android.gms:play-services-ads:15.0.1'
compile 'com.google.firebase:firebase-core:15.0.2'
compile 'com.crashlytics.sdk.android:crashlytics:2.9.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
Things I have already tried.
Clean and Rebuild.
Invalidate Cache and Restart.
Updating gradle version to 4.9.
Setting local gradle for the project.
See my gradle logs here https://drive.google.com/open?id=18bFZdkWX4AFPfpmfjvN1t80WpVRpiHWs
See even release build is generated after these errors. Release apk generated
Update : Recently after Reinstalling Studio, I've created a new project and everything works fine. No errors for "cannot resolve symbol".
not the most graceful solution in the world but deleting and re-cloning the project was the fastest way to resolve this for me.
if you're not using git... well. now is a good time to start.
I tried deleting and re-syncing all the various config files and it didn't do anything.
I got into similar situation: upgraded Gradle to 4.4, then opened a former porject which had been built with Gradle 3.1.2.
Android Studio noticed it and generously offered:
To take advantage of all the latest features (such as Instant Run), improvements and security fixes, we strongly recommend that you update the Android Gradle plugin to version 3.1.2 and Gradle to version 4.4.
When I choose to update, I got the red underlines showing errors everywhere in MainActivity.java, however the project was building and runnig perfectly.
I also tried to rebuild and to invalidate cache & restart, but had no success.
For me, editing the build.gradle (module:app) file helped.
When I modified both compileSdkVersion and targetSdkVersion to the latest (27) and changed the version number of line implementation 'com.android.support:appcompat-v7:2x.x.x' under dependencies to the latest, then resynced, the red lines suddenly disappeared from MainActivity.java and everything became normal.
Maybe not the fiddling with sdk version numbers are important here, but to force a proper gradle resync.
Please note also, that since Gradle 3.4, under dependencies in build.gradle file some configuration words changed: compile, testCompile, androidTestCompile, testApi, androidTestApi become obsolete and should be replaced with implementation or api.
You can find more on this issue here: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration?utm_source=android-studio#new_configurations and a proper explanation on the difference between choosing implementation or api here: https://medium.com/mindorks/implementation-vs-api-in-gradle-3-0-494c817a6fa
I'm new to Android dev and I'm hoping these questions have easy answers:
I'm trying to add this to my Android Studio project. I've managed to get it to work with an on-internet dev box, but now I'm trying to do the same to an offline one.
I think I want to add it as a "library", not as a "module" because I don't want to change it and deal with future version merging.
I've downloaded the release tar.gz file and the only .jar or .aar file I see is "gradle-wrapper.jar". Why'd they include compiled gradle code?
Should I extract this .tar.gz and point Android Studio to it to treat it as a separate project in order to compile a .aar/.jar file? What do I look for to know which directory to treat the the project-directory? Multiple directories include build.gradle files.
Once I have a .jar/.aar, where should I put it exactly? There are so many "lib" directories in here.
Thanks in advance!
The project you wanted to add is available in an online maven repository. You could add it with Gradle with a few lines of script instead of downloading and compiling from source, then adding manually to the library directory.
Gradle is a dependency manager which is able to pull dependencies from online repositories and add it to the project automatically. Depending on your IDE, you may need to install plugins related to Gradle/Maven before proceeding. Then, follow the instructions given in the project's Readme under "Installation". Just by adding those lines in build.gradle, Your IDE should begin to download the library from the repository and add it to your project.
Eureka!
Wow, this is not intuitive. This whole system seems to really, really want an internet connection. How do more serious companies develop software for Android? Surely they're not grabbing just whatever files are hanging around external repositories and going with it are they?
Answer's from here: http://www.b2cloud.com.au/tutorial/using-local-android-library-packages-aar/
There seems to be no way to do this in the GUI.
Gradle and Android Studio don't support .AAR files as well as they do .JAR files. Which strikes me as strange. I guess there are more differences between those file formats than I thought.
To bring in an external .AAR file:
copy it somewhere your dev box can access. The most logical place seems to be "AndroidStudioProjects/yourapp/app/libs"
tell gradle about it by adding the "repository" and "compile" lines below to your app module's gradle file (AndroidStudioProjects//app/build.gradle):
apply plugin: 'com.android.application'
// first important part: tell gradle to treat the libs folder as a repo.
repositories{
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.user.simplelocationtester"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
//here's the 2nd important part: specify the AAR file
compile(name:'Android-SimpleLocation-v1.0.1', ext:'aar')
}
I am developing an android application that requires a Java library application (which I also wrote) to run.
I followed idunnololz guide here to add the project as a java library which seemed to add ok. My java project is called Osmosis and contains 2 packages search and common.
I then tried to reference my project, with Android Studio very helpfully asking if I wish to reference osmosis. This seemed to resolve the error, with import Search.* being added to the top of my android class. However, when I run my application I get the error: package does not exist. Until I click run it shows no errors.
Can anyone give any advice on how to fix this?
I have tried invalidating the caches, cleaning and rebuilding the project
My settings.gradle seems to include the reference:
include ':app', ':osmosis'
and here is my build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.matt.windowrunner"
minSdkVersion 21
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.google.android.gms:play-services:6.5.87'
}
The errors:
Error:(48, 14) error: package search does not exist
Error:(448, 7) error: cannot find symbol variable Search
Error:(460, 7) error: cannot find symbol variable Search
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Error:Execution failed for task ':app:compileDebugJava'.
> Compilation failed; see the compiler error output for details.
Can anyone give any advice on how to fix this?
Your dependencies closure does not pull in the library. Add compile project(:osmosis) after your other two compile lines in your build.gradle.
I'm trying to build my first android app using Android Studio. Unfortunately, every time I open my project, try to run it or gradle assemble it I get the following error :
Gradle 'MalipoBatteryAlarm' project refresh failed:
C:\Users\wickedQuasar\.gradle\daemon\1.10\daemon-6128.out.log
(The filename, directory name, or volume label syntax is incorrect)
What file or directory is causing the problem is unclear. I used to overcome this error by rebuilding my project, changing access rights to username.gradle folder or switching b/w using default and customizable gradle wrappers. From last two days nothing seems to fix it and I'm totally stuck. I've also tried this : Gradle: The filename, directory name, or volume label syntax is incorrect but it didn't fix it.
I've wasted tens of productive hours of my life trying to fix it so any help would be appreciated. From my research I found that this error is usually caused by "unnacceptable characters" in file names. i can't seem to find the cause in my case though.
I'm using a 32bit win 7 machine with Android Studio 0.5.5. My java env variables are set properly.
Update : The command
gradlew build --stacktrace
returns BUILD SUCCESSFUL, but not in the IDE...
Gradle build file for project root :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Module gradle build file :
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:19.1.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Workaround : Switched to commandline now. Assembling using gradle commandline and installing/monitoring using adb and ddms. Everything is dramatically fast now and works like a charm on a dual monitor setup. IDE is still showing the error though...
I just updated Android Studio to version 0.3.2. My project uses Gradle version 1.8.
On the picture below you can see that it is configured in gradle and Android Studio resolver http-async package but gradle fails with Gradle: package com.loopj.android.http does not exist
I tried already
to remove android-async-http and adding it as Library again,
to include fileTree(...) in gradle configuration file,
Rebuilt project but nothing helped
Though if absolute path is set gradle works just fine.
Gradle file
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 11
targetSdkVersion 18
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:support-v4:13.0.0'
compile 'com.android.support:support-v13:13.0.0'
compile 'com.google.android.gms:play-services:3.1.36'
compile files("libs/android-async-http-1.4.4.jar")
}
Can anyone help me with this?
Try to move the libs folder at the same level of src folder.
Android Studio have just released 0.3.7, which claims to have solved a lot of gradle issues such as adding .jar libraries
http://tools.android.com/recent
Hopefully this will help you!