error: cannot find symbol class Android Studio - android

This error hapens after update mac osx or system (I don't know).
It was after I open project that I closed one weak ago.
My settings.gradles is:
include ':app' , ':api', ':daogenerator'
project(':mobilneapi').projectDir = new File("/Users/AndroidstudioProjects/Modules/api")
project(':daogenerator').projectDir = new File("/Users/AndroidstudioProjects/Modules/daogenerator")
And my app gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "pl.wm.myapplication"
minSdkVersion 15
targetSdkVersion 23
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(':api')
compile project(':daogenerator')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
}
When I add import into MainActivity in Main Project.
I have got error after compile:
Error:(6, 24) error: cannot find symbol class Cache
What was wrong?
The same error on gradle build tools 1.3.0 and 1.2.4

try the usual stuff:
rebuild/clean project.
sync project with gradle files.
force close studio64.exe and restart it
restart the computer!
I hate these kind of errors, when nothing works, I usually end up creating a new project and start copying everything to it.

Related

Fixing A Run Time Error for An Android Program

when I was trying to run a simple program , I got an error related to Gradle :
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration':app:_debugUnitTestCompile'.
> Could not resolve junit:junit:4.12.
Required by:
MyApplication:app:unspecified
> Could not resolve junit:junit:4.12.
> Could not get resource 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'.
> Could not GET 'htps://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'.
> Connection to htps://jcenter.bintray.com refused .
I don't know how can I fix it , please help .( I am currently using the android studio version 2.1.2 )
my module build-gradle includes these codes:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.n5110.myapplication"
minSdkVersion 15
targetSdkVersion 23
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:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
}
The problematic part with your gralde.build is this line:
testCompile 'junit:junit:4.12'
This is a unit testing library. If you are just starting and are probably not gonna write testcases for your project then, you can resolve the issue by simply deleting the line. If however you essentially need that library then refer here.

Error including library htmlCleaner

I'm a beginner in android developing whith Android Studio.
I'm trying to include the htmlcleaner library in my project, but when I rebuild the project, Android Studio return this Error
Error: COnfiguration whit name 'default' not found
I added in the root folder of my project the library folder, so I added this line in settings.gradle
include ':htmlcleaner'
and this line in build.gradle
compile project (':htmlcleaner')
Is there anyone who can help me? thanks
to include many informations, I post the build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.rob_company_domain.sunshine"
minSdkVersion 15
targetSdkVersion 23
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:appcompat-v7:23.1.1'
compile project (':htmlcleaner')
}
If you want to add your htmlcleaner library to your project in Android studio, you can do it in three standard ways. Please read this link https://stackoverflow.com/a/35369267/5475941. In this post I explained how to import your JAR files in Android studio and I explained all possible ways step by step with screenshots. I hope it helps.

Android NDK in Android studio 2.0 preview 5 with gradle-experimental:0.6.0-alpha6

I had a problem when using 'com.android.tools.build:gradle-experimental:0.6.0-alpha6' with Android Studio 2.0 preview 5.
Here is my simple project (just hello world):
[https://github.com/nthtrung09it/HelloGradleExperimental][1]
My build.gradle file:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
ndk {
moduleName "NdkLib"
}
defaultConfig {
applicationId "nthtrung09it.android.hello.experimental"
minSdkVersion.apiLevel 15
targetSdkVersion.apiLevel 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles.add(file("proguard-rules.pro"))
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.+'
compile 'com.android.support:design:23.+'
}
Here is problem:
Error:A problem was found with the configuration of task
':app:stripSymbolsArmeabi-v7aDebugArmSharedLibrary'.
Directory 'E:\xxxx\HelloGradleExperimental-master\app\build\intermediates\binaries\debug\arm\obj\armeabi-v7a'
specified for property 'inputFolder' does not exist.
The binaries folder does not exist.
Where is my error? Thanks.
I had same problems. Using newer version of plugin solved it for me - 'com.android.tools.build:gradle-experimental:0.6.0-beta4'.
I'm using Android Studio 1.5.1 though.
EDIT: Now you can use more recent version too: 0.6.0-beta5
Try to create given folder:
$ mkdir E:\xxxx\HelloGradleExperimental-master\app\build\intermediates\binaries\debug\arm\obj\armeabi-v7a

Android Gradle Error - Illegal UTF8 string in constant pool in class

From one day to the other I opened the Android project that I'm currently working on and I got this gradle error, also happens when I try to create a new project:
Gradle sync failed: Illegal UTF8 string in constant pool in class file com/android/build/gradle/tasks/RenderscriptCompile$_ConfigAction_execute_closure7
Also I noticed that the arrangement of all the app packages has changed to this configuration and it is not able to import AppCompactActivity:
Error print screen
I had been trying to find something on the web but so far I found nothing related to this specific case. I tried a few things myself but I think it only made it even worse..
Anyone out there that can help me?
Thanks!
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "my.app.*****.musicpad"
minSdkVersion 14
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.1'
compile 'com.android.support:design:22.2.1'
}
For anyone facing this error i have solved it by deleting the temp files.
Control panel-->Java-->Settings-->delete files and restore defaults.

Unable to use github library in Android Studio

I want to use this library in a project in Android Studio, so as mentioned in read me, I created new project in the Android Studio and added dependencies in build.gradle file inside the app folder as:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.mycompany.swipe_instagram"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.lorentzos.swipecards:library:1.0.8#aar'
}
Then when I sync I started getting this error as:
I have Searched on the google and stack overflow but can't find any appropriate solution.
I used your "build.gradle" file and it is working fine for me (both with and without "aar"). Could be something wrong with the cache. Try "File -> Invalidate Caches / Restart"). Another way to generate more error message detail is to try building the module from the command line and getting verbose output
gradle -info compileDebugSources
You'll get lots of output which should give you a hint as to what's going wrong

Categories

Resources