Fail to resolve third-party libraries - java

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

Related

Android Studio package in external jar cannot be resolved

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')

Silent Compile Error - Third Party Dependency

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.

Failed to resolve dependency while sync with gradle in Android studio 1.2

I just met this error while trying to sync gradle after add a new line in my app gradle file:
compile 'com.umeng.analytics:analytics:latest.integration'
The error is shown as below:
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not resolve com.umeng.analytics:analytics:latest.integration.
Required by:
PalmHeart:app:unspecified
Failed to list versions for com.umeng.analytics:analytics.
Unable to load Maven meta-data from https://jcenter.bintray.com/com/umeng/analytics/analytics/maven-metadata.xml.
Could not GET 'https://jcenter.bintray.com/com/umeng/analytics/analytics/maven-metadata.xml'.
Connection to http://127.0.0.1:8087 refused
And I think it might be something wrong with my http proxy, you can check this picture below:
And here is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.mzzo.palmheart"
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:22.1.1'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.4'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.umeng.analytics:analytics:latest.integration'
compile project(':FloatingActionButton')
compile files('libs/andbase.jar')
compile files('libs/AndroidSwipeLayout-v1.1.8.jar')
compile files('libs/umeng-update-v2.6.0.1.jar')
}
I searched a lot in google but still can't figure out why, hopefully I could find the answer here.
Many thanks.

Changed build.gradle now can't install app delete faild internal error

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'
}

NoClassDefFoundError: android.support.v4.util.ContainerHelpers

I am working on an application. It works perfectly on a device with android 5.0. But crashes constantly on lower versions.
Have so far tried it out on 4.4.4, 4.4.2.
I get the following error.
java.lang.NoClassDefFoundError: android.support.v4.util.ContainerHelpers
at android.support.v4.util.SimpleArrayMap.<init>(SimpleArrayMap.java:209)
at android.support.v4.app.FragmentActivity.getLoaderManager(FragmentActivity.java:867)
at android.support.v4.app.FragmentActivity.getSupportLoaderManager(FragmentActivity.java:861)
at com.client.login.LoginActivity.populateAutoComplete(LoginActivity.java:164)
at com.client.login.LoginActivity.setupView(LoginActivity.java:126)
at com.client.login.LoginActivity.onCreate(LoginActivity.java:71)
I am using android studio for development. My build.gradle is as follows
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId 'com.client'
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug{
}
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/com.fasterxml.jackson.databind.Module'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:22.1.1'
compile 'com.android.support:appcompat-v7:22.1.1'
//compile 'com.facebook.android:facebook-android-sdk:3.21.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.5.0'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.0'
compile 'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.5.0'
compile 'joda-time:joda-time:2.0'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.5.0'
compile 'com.google.guava:guava:18.0'
compile 'com.google.android.gms:play-services:7.3.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.etsy.android.grid:library:1.0.5'
}
Thanks a lot.
Found the solution on this post
java.lang.NoClassDefFoundError: android.support.v4.app.NavUtilsJB error when adding new module in Android Studio
Problem was due to multi dexing being added in lollipop. Had to add the multidex support library to my gradle for previous android versions.

Categories