I am using android studio, while trying to use HttpPost,HttpClient it says cannot find symbol. i surfed on internet and found that if we are at api level 23 we need to add some dependence so i added.
useLibrary 'org.apache.http.legacy'
and
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
}
in my build.gradle file. but even after adding this the same problem exist.
any other solution.
If you are having problem with dependency then download the jar from the following link and add it to your libs folder. Then right click on that jar then select Add as Library.
https://hc.apache.org/downloads.cgi
Related
I don't know how to add this library to my project.
https://github.com/alamkanak/Android-Week-View
thank you.
Edit : can anyone explain how to open the sample app as an android project?
https://github.com/alamkanak/Android-Week-View/tree/develop/sample
In your build.gradle(app:module) add this line in the dependencies block:
implementation 'com.github.alamkanak:android-week-view:1.2.6'
and follow instruction according to the link you posted.
On your file gradle insert into dependencies paste this compile 'com.github.alamkanak:android-week-view:1.2.6'
Example:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:design:26.+'
compile 'com.github.alamkanak:android-week-view:1.2.6'
}
Then click sync now.
Add this line inside module build.gradle file
compile "com.github.alamkanak:android-week-view:1.2.6"
Now sync gradle file and library will be added into project now you can follow instructions on github about calendar customization and settings
I am porting an android application project built with non-eclipse tool, with gradle in use, perhaps the tool was Android Studio. I have the .zip file of the project. So, far I have put all layout,values and drawables in place. I am stuck at the last step of dependencies.
The project depends on Github : BlueJamesBond library and many others. This is the build.gradle dependencies
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:support-v4:+"
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.github.bluejamesbond:textjustify-android:2.1.6'
}
Now, the BlueJamesBond itself is using gradle and I have no idea how gradle works. I was expecting some jar of the library which I could have added in Build Path. Can anyone please suggest how to resolve the dependency in my project?
I am trying to create a new sample app in Android Studio 2.0. When I try to Run or debug it shows a compile time error like,
Execution failed for task ':app:compileDebugJavaWithJavac'.
java.io.FileNotFoundException: D:\Android Studio\newapp\app\libs\core.jar (The system cannot find the file specified)
I had tried by giving path JAVA_HOME C:\Program Files\Java\jdk1.7.0_45 and
Sync project with gradle.
This is My Gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'
...
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1-alpha2'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.0.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'com.google.android.gms:play-services:+'
compile 'org.apache.httpcomponents:httpclient:4.2.6'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile files('libs/core.jar')
}
Even after that I cant find any solution.
Thank You in advance
libs\core.jar (The system cannot find the file specified)
Seems like an obvious error to me...
Remove this line. You don't need it
compile files('libs/core.jar')
You could add a core.jar file into the libs folder, but you still wouldn't need that line since you are already compiling it
Also, pick only one version, please. You don't need to add them multiple times
compile 'com.android.support:appcompat-v7:23.0.1-alpha2'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:appcompat-v7:23.2.0'
Same for these
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:design:23.0.1'
I'm making an interactive login app with Android Studio and wampserver. After creating the Android Studio project, I changed the build.gradle like this:
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Then the IDE keeps showing the following error:
(((Gradle DSL method not found: 'compile()
Possible causes:The project 'Login_wamp' may be using a version of Gradle that does not contain the method.
The build file may be missing a Gradle plugin.
Apply Gradle plugin )))
When I click on Apply gradle plugin, it shows me a lot of plugins. Should I pick one of these options?
What should I do to fix this error?
UPDATE
I have moved the above lines to the other build.gradle file, but I get 2 other problems now:
the support library should not use the different version(21) than the compileSDK version(23).
These lines are my gradles exact shape. Which "21" should be changed to "23" or which "23" should be changed into "21"?
I have changed the
compile 'com.android.support:appcompat-v7:21.0.3' to
compile 'com.android.support:appcompat-v7:23.0.3' and it says that I should Install Repository and sync project.
Here is my build.gradle:
compileSdkVersion 23
buildToolsVersion "23.0.1"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
}
You are using the top level build.gradle
root
|--app
|----build.gradle
|--build.gradle //top level file
|--settings.gradle
In this file you can't use the compile statement:(it is the reason of your issue)
Just move these lines:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
//REMOVE THESE LINES
//compile 'com.android.support:appcompat-v7:21.0.3'
//compile 'com.android.support:support-v4:21.0.3'
//compile 'com.mcxiaoke.volley:library-aar:1.0.0'
}
}
Then you have to add the dependencies in your module/build.gradle file.
EDIT: After your comment.
In your module/build.gradlefile:
use the same version for all support libraries
use the latest (currenlty 23.1.1)
dont' add the same library twice (appcompat)
the 23.0.3 doesn't exist
Here the changes:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1' //update to 23.1.1
//compile 'com.android.support:appcompat-v7:23.0.3' //REMOVE THIS LINE. It doesn't exist and you adding twice
compile 'com.android.support:support-v4:23.1.1' //USE THE SAME VERSION
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
}
I think you are using the wrong build.grade file.
There are two gradle files in your Project.
One is called build.gradle (Project: YourProjectname)
The other one build.grade (Module: app).
Delete the following lines from build.gradle (Project: YourProjectname):
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
Search the dependencies in your build.gradle (app: Module)
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
}
and add the compile lines there:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
}
salam Mehdi. first of all you must open freegate and set proxy settings from android studio settings.(IP=127.0.0.1 and port=8580). after that you must click on apply gradle plugin to update your SDK. after updates done the error must gone. Hope this help you.
I just launched a project in Android Studio 0.8.1 for the first time since upgrading from 0.6.2.
The error thrown is "Error:Module version com.android.support:support-v13:19.1.0 depends on libraries but is not a library itself".
Does anyone have an idea why this is? I have installed some of the new API20 stuff to play with Android L, but the buildTools for this project are still set to 19.1.0.
Here's the dependencies section of my build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.1.+'
compile 'com.android.support:support-v13:19.1.+'
compile 'com.jakewharton:butterknife:5.1.0'
compile 'de.greenrobot:eventbus:2.2.1'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.mcxiaoke.viewpagerindicator:library:2.4.1'
compile 'uk.co.chrisjenx:calligraphy:0.7.+'
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.google.android.gms:play-services:4.4.+'
}
SDK/Buildtools settings are as follows:
compileSdkVersion 19
buildToolsVersion "19.1.0"
Can anyone explain this or point me towards a fix? I'm stumped.
It looks like the support-v13:19.1.0 might have incorrect metadata. Try switching to
compile 'com.android.support:support-v13:20.0.0' and see if your problem persists?