I have upgraded to Android Studio Beta (0.8.0) version from earlier 0.6.x version. After upgrade all the projects (which were working earlier) throws error "Cannot resolve symbol" for everything - String, Activity, file, view - everything. I have done a clean and rebuild;
Obviously I have missed something in the upgrade; What could that be?
And my settings.gradle is:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.grabdata.gdlea.apps"
minSdkVersion 9
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'])
// You must install or update the Support Repository through the SDK manager to use
this dependency.
// You must install or update the Support Repository through the SDK manager to use
this dependency.
compile 'com.android.support:appcompat-v7:19.+'
}
Ran into the same issue. I cleaned and rebuilt the project and everything worked again.
Related
I'm trying to get into developing using android studio, so I recently tried to run a simple login-activity app on it. Basically, what I did was just run the setup for a new android studio project, and selected loginactivity as my default screen. I configured the emulator and hit sync gradle, but it gave me the following response:
image
I downloaded the repository that was required and tried to sync the gradle again, but it again asked exactly the same thing! Please help!
my gradle file for the app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.fyp.fingerpay"
minSdkVersion 23
targetSdkVersion 27
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:10.2.6'
compile 'com.android.support:appcompat-v7:27.+'
}
I think you have forgot to add maven repository in your app gradle file.
Try by doing these steps.
Open the build.gradle file for your application.
Make sure that the repositories section includes a maven section with the "https://maven.google.com" endpoint. For example:
allprojects {repositories {jcenter()maven {url "https://maven.google.com"}}}
Avoid using + in your dependencies as it android studio will try to update dependencies every 24 hours.
Also replace compile by implementation for low APK size.
This question already has an answer here:
When using compile 'com.google.android.support:wearable:2.0.4' I get the error below, but I am not using 26.0.0
(1 answer)
Closed 5 years ago.
I'm developing a music application for both mobile & wear. I've completed building the base of the application on mobile, and now I want to start the wearable (2.0) part. I tried following the tutorial on the Android Developer site, but even following the base directions gives me a Gradle sync error. I tried adjusting the compileSdkVersion and targetSdkVersion both to 24, which I use for my mobile gradle scrip. It didn't make a difference however.
This is the instruction mentioned:
In the build.gradle file for the Wear module:
>> In the android section, confirm that the compileSdkVersion is set to 25.
>> In the android section, confirm that the targetSdkVersion is set to 25.
Update the dependencies section as follows (requires the latest version of the Google Repository):
compile 'com.android.support:wear:26.0.0'
compile 'com.google.android.support:wearable:2.0.3'
provided 'com.google.android.wearable:wearable:2.0.3'
.
Clicking on "install repository and sync project" has no effect.
This is the build.gradle file for the Wear module.
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "be.ehb.dt.finalwork_lievenluyckx_v001"
minSdkVersion 21
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:wear:24.0.0'
compile 'com.google.android.support:wearable:2.0.3'
provided 'com.google.android.wearable:wearable:2.0.3'
}
I'm really new to Android, and I don't really understand what is going wrong here. Any help is appreciated, even if it isn't a direct solution to the issue!
Edited: After trial-error,solution finally was found:
In build.gradle file -> allprojects, within repositories,code below should be added...
1) For the Android Gradle plugin revision 2.3.3 with Gradle 3.3 (Android Studio 2.3.3)
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
2) For the Android Gradle plugin revision 3.0.0 with Gradle 4.1(Android Studio 3.0.0)
allprojects {
repositories {
jcenter()
google()
}
}
For more here: When using compile 'com.google.android.support:wearable:2.0.4' I get the error below, but I am not using 26.0.0
Change your gradle to:
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "be.ehb.dt.finalwork_lievenluyckx_v001"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:wear:26.0.0'
compile 'com.google.android.support:wearable:2.0.3'
provided 'com.google.android.wearable:wearable:2.0.3'
}
Upgraded to:
Android Studio 3.0 Canary 2
com.android.tools.build:gradle:3.0.0-alpha2
I have a multi-module project (main app + sub modules)
Inclusion inside the main app:
dependencies {
implementation project(path: ':testlib', configuration: 'default')
}
The testlib is defined as a simple android library project and works normally when included with gradle 2.3.0 and via compile project(path: ':testlib')
I get the following gradle error message:
Could not resolve all dependencies for configuration ':app:devDebug_signedCompileClasspath'.
Selected configuration 'default' on 'project :testlib'
but it can't be used as a project dependency because
it isn't intended for consumption by other components.
What does "isn't intended for consumption by other components" mean in this context? The module is defined as an android library.
Here is the build.gradle of the testlib:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
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'])
}
What am I missing?
I also got this error. Android Studio 3.0 Canary 4 just came out. I updated to it, which also updates gradle to 4.0rc1.
The problem went away on it's own.
alter your Top-level build file (aka root gradle)
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
still not working?
update dist-url (inside gradle-wrapper.properties)
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-rc-1-all.zip
Since downloading the new Android Studio Beta I have a problem with my (professional) apps that have the Crashlytics plugin enabled.
Since the new IDE version/Gradle version they can't compile at all anymore. It's either the app:debugCompile or app:releaseCompile proces that takes ages and never gets resolved. (Yesterday I let it compiling for 3 hours and it never finished).
I even tried setting up a fresh new Android project as a test without any additions which off course ran fine, but once I added Crashlytics the problem described earlier showed up again.
I can't be the only one with this problem, can I? Or am I missing something?
This is the Gradle file of my test project, the Crashlytics part is added with the AS plugin
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.yungpanda.testprojectfortest"
minSdkVersion 9
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.android.support:appcompat-v7:20.+'
compile 'com.crashlytics.android:crashlytics:1.+'
}
I have been using AndriodAnnotations with Eclipse (ADT) without any issue. Recently, I decided to explore Android Studio. Using Android Studio with AndroidAnnotations has a few issues when I build the app. Below is the error:
I can run the app without any issues when it is showing three errors.
Below is my build.gradle:
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2+'
}
}
apply plugin: 'android'
apply plugin: 'android-apt'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.test.restaurantmenu"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
apt {
arguments {
androidManifestFile variant.processResources.manifestFile
resourcePackageName "com.test.restaurantmenu"
}
}
dependencies {
apt "org.androidannotations:androidannotations:3.0+"
compile "org.androidannotations:androidannotations-api:3.0+"
compile 'com.android.support:appcompat-v7:+'
compile 'com.github.satyan:sugar:1.3'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
I've enabled the annotation processors as follow:
Is there any steps I missed or wrong in my setup?
I installed "Android SDK Tools 23.0.2" and all the errors were solved.
if you're using kotlin and you're getting an error showing
error: annotations are not supported in -source 1.3 (use -source 5 or
higher to enable annotations)
There is a workaround for it
Open Project Structure (File -> Project Structure). Select the module.
Change the source compatibility and Target compatibility from kotlin 1.3
to jdk 1.8