I'm running Andorid studio 3.0 Canary 1.
The device runs Android O preview
This is my app's build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-O'
buildToolsVersion '26.0.0-rc2'
defaultConfig {
applicationId "com.testqouta"
minSdkVersion 19
targetSdkVersion 'O'
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'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:appcompat-v7:26.0.0-beta1'
}
This is the project's build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
When I try to execute this lines:
StorageManager storageManager = (StorageManager) getSystemService(Context.STORAGE_SERVICE);
storageManager.getCacheQuotaBytes(storageManager.getUuidForPath(getCacheDir()));
My app crashes with this exception:
java.lang.NoSuchMethodError: No virtual method getCacheQuotaBytes(Ljava/util/UUID;)J in class Landroid/os/storage/StorageManager; or its super classes (declaration of 'android.os.storage.StorageManager' appears in /system/framework/framework.jar)
at com.testqouta.MainActivity.onCreate(MainActivity.java:25)
at android.app.Activity.performCreate(Activity.java:6767)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1195)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2699)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2805)
at android.app.ActivityThread.-wrap12(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1537)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6408)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:232)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:751)
The app crashes both on getCacheQuotaBytes and getUuidForPath.
It's worth mention that these methods are from the new Android O API.
Related
My app crash on startup because of Firebase and I don't know why. I use in my app OneSignal. I am getting this error messages:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tosi.man, PID: 1086
java.lang.NoSuchMethodError: No static method isDeviceProtectedStorage(Landroid/content/Context;)Z in class Landroid/support/v4/content/ContextCompat; or its super classes (declaration of 'android.support.v4.content.ContextCompat' appears in /data/app/com.tosi.man-2/split_lib_dependencies_apk.apk)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1769)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1744)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5990)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5561)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5500)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1595)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:208)
at android.app.ActivityThread.main(ActivityThread.java:6267)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
This is my build.gradle (Module App):
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.tosi.man"
manifestPlaceholders = [
onesignal_app_id : 'b53b7c1c-c8c2-4646-a1e8-ea7b4c5d2876',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]
minSdkVersion 15
targetSdkVersion 23
versionCode 18
versionName "2.0.5"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
allprojects {
repositories {
flatDir {
dirs 'libs'
}
google()
jcenter()
maven {
url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
}
maven {
url 'http://swisscodemonkeys.github.io/appbrain-sdk/maven'
}
}
}
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.10.2'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
dependencies {
implementation 'com.google.firebase:firebase-core:11.0.4'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:mediarouter-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:multidex:1.0.3'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.appbrain:appbrain-sdk:+#aar'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'org.xwalk:xwalk_core_library:10.39.235.15'
compile 'com.google.android.gms:play-services-cast-framework:11.0.4'
compile 'com.android.support:support-vector-drawable:23.4.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
And this is my build.gradle (Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Can you please help me? I am not sure why I am getting this error maybe I have bad versions of dependencies. Thank you very much.
update few things
Google play service
Google repository
My android studio is failing to build right now due to the execution failed for task and it says I have more than one library with package name android.support.graphics.drawable. Here is my build.gradle (Project: DemoApp)
// 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:2.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle for (Module: app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.0"
defaultConfig {
applicationId "com.example.rishavsharma.demoapp"
minSdkVersion 15
targetSdkVersion 28
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:28.+'
testCompile 'junit:junit:4.12'
}
I tried starting a new project with the new version 3 of Android Studio. I get this error message:
here is gradle.wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip
root.gradle
buildscript {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.zabitoglu.myapplication"
minSdkVersion 15
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'])
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:25.1.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta5'
}
I tried resolve the issue with the invalidation of cache method, and stopping Gradle daemon, but nothing happen ..
i'm trying to import clarifai api in my android project but it gives the following error :
Error:(28, 13) Failed to resolve: com.clarifai.clarifai-api2:android:2.0.2
project.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:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "ir.codinglab.objectrecognizer"
minSdkVersion 15
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'
}
}
lintOptions {
lintConfig rootProject.file('gradle/lint.xml')
}
}
dependencies {
compile 'com.github.markushi:circlebutton:1.1'
compile 'com.clarifai.clarifai-api2:android:2.0.2'
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'
})
testCompile 'junit:junit:4.12'
}
I have to note that i don't have any problems with importing other libraries .
Thank you in advance.
the library you have entered is wrong. This is the correct one -
compile 'com.clarifai.clarifai-api2:core:2.2.3'
I have an error with my build.gradle. I try to link to the Github project but it failed.
build.gradle(Project:XXXX)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
//mavenCentral()
maven { url "https://maven/jjhesk" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
maven { url "https://maven/jjhesk" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(Module:XXXX)
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.google.testingtimer"
minSdkVersion 16
targetSdkVersion 24
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(include: ['*.jar'], dir: 'libs')
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:24.2.1'
compile 'com.github.pheynix:TimerView:660400fb64'
//androidTestCompile 'junit:junit:4.12'
}
I try to follow these instructions which is in this website:
https://github.com/pheynix/TimerView/blob/master/README_ENGLISH.md
https://github.com/Todd-Davies/ProgressWheel
Could someone help me to solve the problem?
I had the same error today. To fix that, I opened build.gradle file and replaced the 2 occurences of:
repositories {
jcenter()
}
By
repositories {
maven { url "http://jcenter.bintray.com" }
jcenter()
}
In my case the problem was caused by the proxy. It has problems with https then I'm forcing the use of http.