After downloading and installing the API 24 source code, I am seeing a large number of compiler errors in classes that have changes in API 24.
For example, the AccessibilityService class has hundreds of "Cannot resolve symbol" errors on variables, methods, imports etc.
I have tried deleting and redownloading sources multiple times to no avail. Is this a common occurrence with a new set of sources or did I do something wrong?
Edit:
Here is my app Gradle file, and I am using 'com.android.tools.build:gradle:2.1.0'
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.nyelito.dactyl"
minSdkVersion 23
targetSdkVersion 24
versionCode 10
versionName "1.2.2"
}
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(
[group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.4.1'],
)
provided 'org.glassfish:javax.annotation:10.0-b28'
compile('com.mikepenz:aboutlibraries:5.6.7#aar') {
transitive = true
}
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.github.medyo:android-about-page:1.0.5'
compile 'com.github.thepacific:adapter:1.0.5'
compile 'com.google.firebase:firebase-database:9.0.2'
compile 'com.google.firebase:firebase-messaging:9.0.2'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.github.paolorotolo:appintro:4.0.0'
}
apply plugin: 'com.google.gms.google-services'
Here is a screenshot of what it looks like
When you change compileSdkVersion, you also need to change buildToolsVersion to something compatible. In this case
buildToolsVersion 24.0.2
#Code-Apprentice is right, you need to change buildToolsVersion with the major version number compatible with your compiled sdk version.
'android-24' requires JDK 1.8 or later to compile
https://developer.android.com/guide/platform/j8-jack.html
Also, I found you compiled with API 24, which needs JDK8. Please adds the following in your build.gradle
android {
...
defaultConfig {
...
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Related
How can I stop building for API23? I have many libraries, reduced probably all to API22 from API23. Still I have problems, when want to sync my gradle, it is showing errors in V23 styles.
Is there a way to disable building V23? I don't want to use API23. Don't tell me to update my project to API23 because in my app, permission checking is not necessary. It's inside company app (not for Google Play) and permission dialogs are not necessary.
This is error
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Here is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.pongodev.layartancepapp"
minSdkVersion 16
targetSdkVersion 22
versionCode 2
versionName "2.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:recyclerview-v7:22.1.0'
compile('com.mikepenz:materialdrawer:4.4.6#aar') {
transitive = true
}
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:7.3.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
testCompile 'junit:junit:4.12'
compile 'com.mcxiaoke.volley:library:1.0.0'
compile 'com.github.mrengineer13:snackbar:1.0.0'
compile 'com.marshalchen.ultimaterecyclerview:library:0.3.18'
compile 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
compile 'com.mikepenz:google-material-typeface:2.2.0.3.original#aar'
compile 'com.github.AndroidDeveloperLB:MaterialPreferenceLibrary:1'
}
You can define compileSdkVersion and buildToolsVersion to 22 in build.gradle
compileSdkVersion = 'Google Inc.:Google APIs:22'
buildToolsVersion = "22.0.0"
These steps works for you:
1.Click build.gradle
2.Change compileSdkVersion 23 to 22
3.Change targetSdkVersion 23 to 22
follow pics
See Picture for clear understanding
I am new to android studio And I'm trying to import eclipse project in android with few dependent android projects.
Please see below attached image and my message console for the error.
I have tried by changing API version to 24 which is latest nothing happen and again back to API 21 after one answer on SO.
Gradle version.
In wrapper I've 2.14.1 and in file I've 2.1.3
build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "package.name"
minSdkVersion 11
targetSdkVersion 21
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':comtwittersdkandroid_twitter')
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:appcompat-v7:21.2.0'
compile files('libs/httpclient-4.3.3.jar')
compile files('libs/httpcore-4.4.1.jar')
compile files('libs/httpmime-4.3.jar')
compile files('libs/twitter4j-core-3.0.5.jar')
compile files('libs/universal-image-loader-1.8.0.jar')
compile files('libs/zxing-1.7-core.jar')
compile files('libs/zxing-integration.jar')
}
I've tried adding jar instead of compile statement, it's not working.
Any help will be appreciated, thanks in advance.
Since you are using
compile 'com.google.android.gms:play-services:+'
you have a dependency with the support libraries v24 which require api 24 to compile.
You have to use:
compileSdkVersion 24
Thanks for your help, I finally break into the issue that is I have to delete com_crashlytics_export_strings.xml file from my project.
As I switch to API version 23 I removed http jars and added compile statements to build.gradle
One Important thing I've observed is "if you've dependent projects please cross check everything, as the main project mostly do not compile because of the issue with using same lib. in dependent projects or deprecated functions; as I have one for maps in one of my classes.
my build.gradle file
apply plugin: 'com.android.application'
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "package-name"
minSdkVersion 11
targetSdkVersion 21
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile('org.apache.httpcomponents:httpmime:4.3.6')
compile files('libs/universal-image-loader-1.8.0.jar')
compile files('libs/zxing-1.7-core.jar')
compile files('libs/zxing-integration.jar')
compile files('libs/gcm.jar')
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.android.support:appcompat-v7:23.2.0'
}
Thanks for the help. Answer to help anybody who faces same issue in the future.
Here is my Gradle build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "problemio.com.problemionew"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
My application compiled ok, but when I tried to run it, I got this error:
Any thoughts on what is going wrong here? My machine is set up for Java 6. When I tried to upgrade to Java 7 I got some errors so I had to revert to Java 6.
That error is due to problem in compilation which usually related to duplicated libraries or too many methods and classes. I guess that you are including google play services in you gradle . Try to use specific sub library from here https://developers.google.com/android/guides/setup.
This error
This error about for uses and give referance same classes.Look here
I want to use the FloatingActionButton but for that I need the library:
compile 'com.android.support:design:22.2.0'
But when I add it to my gradle, I get the message:
A problem occurred configuring project ':myModule'.
Could not resolve all dependencies for configuration ':myModule:_debugCompile'.
Could not find com.android.support:design:22.2.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/design/22.2.0/design-22.2.0.pom
https://jcenter.bintray.com/com/android/support/design/22.2.0/design-22.2.0.jar
file:/D:/Development/Android/sdk/extras/android/m2repository/com/android/support/design/22.2.0/design-22.2.0.pom
file:/D:/Development/Android/sdk/extras/android/m2repository/com/android/support/design/22.2.0/design-22.2.0.jar
file:/D:/Development/Android/sdk/extras/google/m2repository/com/android/support/design/22.2.0/design-22.2.0.pom
file:/D:/Development/Android/sdk/extras/google/m2repository/com/android/support/design/22.2.0/design-22.2.0.jar
Required by:
myProject:myModule:unspecified
I tried updating my Android SDK but everything is up to date:
So why can't com.android.support:design:22.2.0 be resolved?
This is my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "de.bla.myProject"
minSdkVersion 19
targetSdkVersion 22
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':androidcircularcrop_lib')
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:design:22.2.0'
compile files('libs/eventbus-3.0.0-beta1.jar')
compile files('libs/mpandroidchartlibrary-2-1-0.jar')
compile files('libs/picasso-2.4.0.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
}
Looking at your build file, always set target and compile sdk to the same number. The appcompat lib is also a part of the sdk so when using a 22.x.x support lib, you are goning to need at least the 22 sdk to ensure compatibility, let alone finding the lib.
Also as Arkadiy suggested it is recommended to use the latest build-tools and gradle version compatible with your android studio.
I just updated my android studio to the latest version with the new gradle version also, running my application gives me an error class android support v4 has been already added to the output don't know what is going wrong i check if there is a jar duplicated or a library duplicated couldn't find anything. here is my app:build.gradle
enter code here
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
lintOptions
{
checkReleaseBuilds false
//abortOnError true
}
defaultConfig {
applicationId "package name"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes
{
release {
minifyEnabled true
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
dexOptions {
preDexLibraries = false
incremental true
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project('Libraries:UniversalImageLoader')
compile project('Libraries:facebook')
compile project('Libraries:pull-to-refresh')
compile files('Libraries/gcm.jar')
compile files('Libraries/quickblox-android-sdk-chat-2.0.jar')
compile files('Libraries/quickblox-android-sdk-core-2.0.jar')
compile files('Libraries/quickblox-android-sdk-messages-2.0.jar')
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.google.maps.android:android-maps-utils:0.3'
compile 'com.squareup.picasso:picasso:2.4.0'
compile "com.android.support:appcompat-v7:21.0.2"
}
I took of this
compile 'com.android.support:support-v4:21.0.2'
i thought its already included in the appcompat-v7 but it did not solve my issue yet
I downgraded my Android Studio version to 0.8.6 and the "Duplicate Copies" error disappear.
It isn't a perfect solution but for now and for me it is the unique solution currently.