I have been developing this android for some days now, and suddenly the application build has a lot of errors and doesn't run. First few errors are listed below
D:\somepath\someotherpath\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.3\res\values-v11\values.xml
Error:(50, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(50, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(50, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(50, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
A couple of things might have caused these errrors are listed below
I was attempting to speed up the Emulator by using Intel HAXM, and also use Genymotion. I can see changes in the dependencies of the build.gradle
build.gradle old
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "org.nirvanasoftware.donor_app"
minSdkVersion 8
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.0.0'
compile 'com.android.support:support-v4:20.0.0'
}
**build.gradle New **
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "org.nirvanasoftware.donor_app"
minSdkVersion 8
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:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
}
Is the change in dependency causing build errors or something else.
In the dependencies you have used appcompat-v7:21.0.3 and support-v4:21.0.3
But your compileSdkVersion is 20 buildToolsVersion is "20.0.0"
As I know if you use compileSdkVersion 20 then you should use buildToolsVersion "20.0.0" and the version of support library should also be 20 not 21. If you want to use appcompat-v7:21.0.3' and support-v4:21.0.3' you must use compileSdkVersion 21 and buildToolsVersion 21.x.y (here x and y will be the number according to your build tools that you have installed on your computer)
I am not sure that all of your problems are caused for this. But if there is a problem in your gradle synchronization then suddenly you will have a lot of problems. So if you do not have errors other than your gradle build file then your problems should be removed.
My suggestion is if you want to use latest SDKs and Support libraries install the latest build tools and SDKs from the Android SDK Manager then use
compileSdkVersion 21
buildToolsVersion "21.1.2" // your latest build tools
and dependencies like this
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
}
Hope it will solve your problems. Happy coding :D
In addition: In the latest gradle version that is gradle-1.0.0 runProguard is a deprecated method. So instead of using it you must use minifyEnabled and update your gradle version to 1.0.0.
Related
My IDE is Android Studio 2.0. SDK is 23
This is my error log(there are so many same logs and I list only one):
05-10 22:19:21.430 1835-1835/edu.jazzy.testconsumer E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method edu.jazzy.testconsumer.MipcaActivityCapture.access$super
my build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "edu.jazzy.testconsumer"
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 files('libs/zxing.jar')
}
And I don't know why there is always occur error after I google for hours.
You get this sort of message whenever there is code in your app that refers to classes/methods/fields that do not exist on the device. So long as you do not actually execute any lines that refer to those missing items, there is no problem.
Note that the question linked to from the comments is for a case where there is an actual crash, in that case due to some unfortunate reflection from Otto. Your error message from your question is not a crash.
I want to create an android app and I need an external SDK which I added to my project according to this answer: https://stackoverflow.com/a/30726911/4276486
In the picture below you can see that the packages in the external .jar cannot be resolved. However, when I am typing the IDE does autocomplete the package names but complains afterwards that the package cannot be resolved.
Any ideas how to fix this issue?
My gradle build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "dhbw.naorobotapp"
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(':java-naoqi-sdk-2.1.4.13-win32-vs2010')
}
Add this in your app gradle under dependencies, after you paste the .jar file under /libs
compile files('libs/<your jar filename>.jar')
I develop with Android version 23. But now I like to debug a device having only version 19 installed.
To do it I changed my gradle file to
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.mydomain.myapp"
minSdkVersion 16
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile fileTree(include: ['dtp_library'], dir: 'libs')
compile project(':libs:dtp_library')
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.android.support:design:19.+'
compile 'com.android.support:support-v4:19.+'
}
But this line
compile 'com.android.support:design:19.+'
throws the compiler error
Failed to resolve 'com.android.support:design:19.+'
How to make it work?
This is a sample of my build.gradle and it runs absolutely fine on an API 19 device.
Few things to note are that you don't need to decrement the compile SDK. This is like having Java 8 installed, but compiling Java 6 code. It still works.
Also, I think the appcompat-v7 library depends on the support-v4 library, so you don't need to include that.
apply plugin: 'com.android.application'
repositories {
jcenter()
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.androidstack.app"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
}
ext {
supportLibVersion = '23.2.1' // variable that can be referenced to keep support libs consistent
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
}
Remove compile 'com.android.support:design:19.+' then try
I download a Android Studio project from https://github.com/chenyangcun/MaterialDesignExample . I add it to my Android Studio and run it,but there occurs some errors:
The blew is the build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.aswifter.materialexample"
minSdkVersion 15
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.android.support:design:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.loopj.android:android-async-http:1.4.7'
compile 'com.google.code.gson:gson:2.3'
compile 'com.afollestad:material-dialogs:0.7.6.0'
}
And then I build a whole new Android project with the same "third-party libraries"
The blew is my bulid.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.mummyding.app.test"
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 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.loopj.android:android-async-http:1.4.7'
compile 'com.google.code.gson:gson:2.3'
compile 'com.afollestad:material-dialogs:0.7.6.0'
}
What confuses me is the "error info":
compile 'de.hdodenhof:circleimageview:1.3.0' is okay in this project!!!
so my questions:
Can you run this project in your Andorid Studio?
Why the "error info" different?
How to fix it?
PS:
Gradle Version : 2.2.1
IDE: Android Studio 1.2.1.1
OS: Ubuntu 15.04
I am in China but I have got a router with shadowsocks (which means I can visit any website I want)
It really confuse me for a long time,so any suggestion will be highly appreciated,thank you advance.
The problem may be your proxy settings. You may need to set the following in gradle.properties (please modify according to your proxy settings):
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=8123
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=8123
I fixed it!!!!
It's not caused by GFW .It works well when I replaced OpenJDK with Oracle-JDK on my ubuntu!
Please try this with sudo
dnf install python3-m2crypto
https://fedora.pkgs.org/35/fedora-x86_64/python3-m2crypto-0.38.0-2.fc35.x86_64.rpm.html
I changed my gradles compileSdkVersion from 21 to 22 and forgot about it, a day later I plugged my phone in and wanted to debug my app, after trying to install once i get this message:
Installation failed since the device possibly has stale dexed jars that don't match the current version (dexopt error).
In order to proceed, you have to uninstall the existing application.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?
and after hitting the "ok" button i get this error:
DEVICE SHELL COMMAND: pm uninstall com.themeteam.roeikashi
DELETE_FAILED_INTERNAL_ERROR
this is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.themeteam.roeikashi"
minSdkVersion 15
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.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:support-v4:13.0.+'
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile 'com.github.clans:fab:1.5.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:cardview-v7:22.1.1'
compile 'com.android.support:recyclerview-v7:22.1.1'
}
I could use some help on what to do, since I deleted all the files I could find that have a connection to my app and that doesn't seem to work.
I also changed back my compileSdkVersion to 21 which didn't work.
Thanks in advance!
The problem was in the gradle file, the compileSdkVersion was accidentally changed from 21 to 22, so I had to change it back, change the buildToolVersion and the target sdk version to the latest version.
the comments were way off, I ended up deleting all my phones cached data as my app does save some data on the phone itself and that didn't work.
It just occured to me that I should use the latest version and that fixed it.
here's the new gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.themeteam.roeikashi"
minSdkVersion 15
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.1.1'
compile 'com.android.support:support-v4:13.0.+'
// compile 'com.parse.bolts:bolts-android:1.+'
// compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
}