I'm having a silent compile-time error while trying to incorporate a third party library into my app. I have followed all the steps to add the library to my app, and it appears to be working (No red lines, no errors, looks good to run). But as soon as I hit run, it throws errors saying error: package me.iwf.photopicker does not existand error: package me.iwf.photopicker.utils does not exist. Here are my files:
PhotoPicker (Third party Library) build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
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.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:design:22.2.0'
compile 'com.github.bumptech.glide:glide:3.6.0'
}
App build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "projects.noteapp"
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:+'
}
Settings.gradle
include ':app', ':libs:photopicker'
If you need any more info, just comment and ill post it.
If its important, the library I' using is this one:
https://github.com/donglua/PhotoPicker
Figured it out!
For anybody with the same problem, I had to add compile project(':libs:photopicker') to the App build.gradle file.
Related
I'm new to Android Studio, I tried everything to solve this problem "Failed to resolve: com.android.support:appcompat-v7:28.+ "
I tried to clean project , invalidate cash/restart and removing .idea and still the same
I'm using android studio 2.2.1 for a learning reason , and I updated it to android studio 3 and there a multiple rendering problems so I returned back to version 2.2.1
I tried to add
maven {
url 'https://maven.google.com/'
name 'Google'
}
So,It stuck with another problem
"Error:Execution failed for task ':app:processDebugResources'.
> Error: more than one library with package name 'android.support.graphics.drawable'"
Error Photo
Finally I tried to change "appcompat-v7:28.+" to "appcompat-v7:27" and it' works but still tell me that i should use the same library to avoid mistakes
This is my Gradle code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.1"
defaultConfig {
applicationId "com.example.aimlive.myapplication"
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'
}
Replace 'com.android.support:appcompat-v7:28+' by 'com.android.support:appcompat-v7:28.0.0'
and add below dependencies
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
try adding this to your code:
repositories {
jcenter()
maven { // <-- Add this
url 'https://maven.google.com/'
}
}
Update: Now you moved on to another error:
Error: more than one library with package name 'android.support.graphics.drawable ...
To fix this, you need to change compile to implementation in dependencies part.
if you are using
compileSdkVersion 28
add in your dependencies below code
implementation 'com.android.support:appcompat-v7:28.0.0-alpha'
this is the link
Try this one, hope it is working
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
dependencies
classpath 'com.android.tools.build:gradle:3.1.4'
android
compileSdkVersion 28
minSdkVersion 21
targetSdkVersion 28
Try this code, hope it will be working. Thanks
build.gradle (Project)
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
build.gradle (app)
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "YOUR_PACKAGE_NAME"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies check for implementation
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
}
I found that 'com.android.support:animated-vector-drawable' and 'com.android.support:support-vector-drawable' have a same package name in support library version 28.0.0. Normally this does not make the problem.
But if you have the following line in gradle.properties
android.uniquePackageNames = true
you will see the error
more than one library with package name 'android.support.graphics.drawable'"
If you should use the uniquePackageNames option, use androidx instead of support library 28.0.0.
In case someone like me stuck for hours and find out the you have to check the maven dependency "com.android.support:appcompat-v7:28.0.0". remove the "+" sign as gradle does not like it for unpredictable versions. so i had to check the maven repository and found that i was compiling with 29 and 29 does not exist. please check below link
[""][1]
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.amirkhan.birthday"
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 {
implementation 'com.android.support:appcompat-v7:28.0.0'
}
2)) Maven should be included.
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
google()
}
}
Wallah the problem is solved
[1]: https://mvnrepository.com/artifact/com.android.support/appcompat-v7/28.0.0
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 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
Using gradle with android.
I am trying to get powermock to compile as a dependency.
I have dumbed down my attempts to get this working and it is still not working. Below is my build.gradle and activity. I am just doing it this way to demonstrate the error and trying to get it working.
//Error
error: package org.powermock.api.easymock does not exist
import org.powermock.api.easymock.PowerMock;
//build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "android.testing.powermock"
minSdkVersion 19
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.0.0'
compile 'org.easymock:easymock:3.3.1'
compile 'org.powermock:powermock-easymock-release-full:1.6.2'
}
//MainActivity
package android.testing.powermock;
import org.powermock.api.easymock.PowerMock;
public class MainActivity extends Activity {
//not important
}
Add this dependency to your build.gradle
testCompile 'org.powermock:powermock-api-easymock:1.6.2'
If you're using it outside of the test classes change the testCompile to compile.
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'
}