Failed to resolve:com.loopj.android:android-async-http:1.4.8 - android

I have downloaded jar file of Loopj library and placed it in libs folder. have tried many changes but getting same error. Can anyone please help me to solve this.
build.gradle :-
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.pratik.receivedsms"
minSdkVersion 16
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.jakewharton:butterknife:7.0.1'
compile 'com.loopj.android:android-async-http:1.4.8'
}

What worked for me is opening gradle terminal from android studio and executing the following command:
gradlew installarchives
It should also work without downloading the jar file.
Another note is that I am using version 1.4.5.
Good luck!

Related

Could not find class xxx referenced from method xxx when running app on API 19

I have a problem when I try to run my application on android device that uses API level 19 (Android 4.4.2). When I run the app on API>21 it works perfectly fine.
The errors I'm getting:
I tried setting buildToolsVersion to 19.1.0 instead of 23.0.3 but then I can't use MultiDex and I can't build the app without it.
here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "multisoft.testsurfaceview"
minSdkVersion 19
targetSdkVersion 19
versionCode 1
multiDexEnabled true
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:19.0.0'
compile files('/Users/admin/Desktop/Projects/testsurfaceview/libs/classes.jar')
}
I can't seem to find where the problem could be, any suggestions?
remove this compile files('/Users/admin/Desktop/Projects/testsurfaceview/libs/cl‌​asses.jar') from dependencies.
And just add the jar in libs folder and tried it..
see this link you will find your answer.
basically you did not configure multidex properly.
enter link description here

Gradle 'MyApp' project refresh failed. A strange kind of error

I have recently update Android Studio to Android Studio 2.1.2. I have stuck with a strange error. Error is printed below. This happens when I just create new android studio project.
Gradle 'myapp' project refresh failed
Error:No toolchains found in the NDK toolchains folder for ABI with prefix: aarch64-linux-android
Note : I am using java8 and the module gradle.build file looks like below. Since I have just created the project I have not added any NDK related files.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.myapp"
minSdkVersion 11
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.4.0'
}

Android Studio - Rendering Error And Can't to Adding Plain TextView

When I Create A New Project in Android Studio , Show this Error And i Can't Create EditText And Plain TextView.
Project Structure PIC
How I Resolve This Problem ?
My Gradel Build :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.mr_enginner.first_project_run"
minSdkVersion 17
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.1.1'
compile 'com.android.support:design:23.1.1'
}
Make sure put the java version in the project settings. "Project structure" in File menu.

Unable to sync gradle

I get error messages when I try to add recyclerview and cardview dependencies to my build.gradle. Here is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.truewebdev.applytheme"
minSdkVersion 17
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.2.0'
compile 'com.android.support.recyclerview-v7:23.2.0'
compile 'com.android.support.cardview-v7:23.2.0'
}
Here are the error messages:
If I try to install repository, I get the following:
What is wrong here?
Did you download the Android Support Repository from the SDK Manager?
From android docs:
Make sure you have downloaded the Android Support Repository using the SDK Manager.
http://developer.android.com/tools/support-library/setup.html#libs-with-res

Add Dependency to module - External Library Error

I've created an external library that I was hoping to make open source. I import it as a module without issue.
I have to resolve this issue after import:
Adding the dependency is what I want to do. I don't want to move it to :app.
When I add the dependency, the issue goes away. The import references the correct file. On build I get this issue:
I figure the solution has to be with referencing the java file in the build.gradle file for the external library but I couldnt find any good examples or even proof that this would resolve the issue.
library is the module name.
Thanks in advance.
Edit:
build.gradle for the app
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"
defaultConfig {
applicationId "com.weaverprojects.toundertest1"
minSdkVersion 21
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.google.android.gms:play-services-gcm:7.5.0'
}
build.gradle for library
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"
defaultConfig {
minSdkVersion 19
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.1'
compile 'com.google.android.gms:play-services-gcm:7.5.0'
}
Settings.gradle
include ':app', ':library'
Assuming that your library exists as it's own project, and it'd path relative to the top level folder for your main project is ../mylibs/library/ I think your settings.gradle should change as follows:
project(':library').projectDir = new File('../mylibs/library/');
and the following needs to go inside the dependencies section of your main/app/build.gradle file (which I think is the first code dump in your question).
compile project(':library')
BTW, please consider renaming :library to something else (this is not the source of the problem but the name can be confusing when you look at it some months later)

Categories

Resources