I'm using the gradle build script, in android studio to fetch the Parse android SDK, as follow:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.parse.bolts:bolts-android:1.+'
}
The build process succeeds with no errors, yet , when I the to import com.parse.Parse; I get cannot resolve symbol parse.
To my understanding, that build script was supposed to download the Parse SDK from a maven repository, and build it, or otherwise to fail.
Where do I have wrong?
Check Parse's Android Studio guide again, you'll see this:
Step 1 instructs you to download the SDK.
Step 2 asks you to first put Parse-*.java to the project's libs folder, and then add the script you've shown in your question into build.gradle. Notice that the library pulled from maven is just an auxiliary library, not the Parse library itself. This is why Android Studio cannot find the Parse class.
Related
I have to integrate Paypal in my app so i got tutorials here and here.
In tutorial i found that download the Jar and add as library. I cant find jar file in this link. It have aar file only.
But in the link they said for android stdio do this :
Add the SDK to Your Project
The PayPal Android SDK is now available at Maven Repository. The latest version is available via mavenCentral(). Just add the following dependency from mavenCentral():
compile 'com.paypal.sdk:paypal-android-sdk:2.13.1'
SO My build.gradle file looks like :
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.paypal.sdk:paypal-android-sdk:2.13.1'
}
ERROR GETTING:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not determine artifacts for com.paypal.sdk:paypal-android-sdk:2.13.1: No cached version available for offline mode
After Disabling OFFILNE MODE AND SYNC it takes much time . not finished the process gradle sync.
I cant able to integrate Paypal in android studio...
Anyone tell me what i have done wrong and how to integrate ?
thanks.
3.0.1.jar and okio-1.6.0.jar latest jar files
compile files('libs/okhttp-3.0.1.jar')
compile files('libs/okio-1.6.0.jar')
compile project(':PayPalAndroidSDK-2.13.1')
I need to integrate MoPub inside an android library shared by 3 different games.
I tried to use the fabric plugin with no success... after some attempts I get this error:
Error:Failed to resolve: com.mopub.volley:mopub-volley:1.1.0
Then I also tried to follow this guide that you can find here (https://github.com/mopub/mopub-android-sdk/wiki/Getting-Started) but I always get some errors (I can't execute the gradle command via terminal or I get the same error as mentioned above).
Can someone help me?
Thank you,
Mirko
UPDATE
Thanks to #Edward I was able to import correctly mopub-sdk in my project.
In order to fix the mopub-volley error, first clean the solution, read which files are missing in the console, look at the path, recreate the indicated path and add mopub-volley-1.1.0.jar, mopub-volley-1.1.0.pom in that folder.
Rebuild and you are ready to go!
In my case, mopub-sdk was looking for the mopub-volley lib inside an
inexistent folder in the same path of the android sdk.
If you get another error related to the millenial sdk, add this line in the dependencies section of the build.gradle file inside the mopub-sdk library:
compile fileTree(dir: 'libs', include: ['*.jar'])
you should get something like this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:support-annotations:22.0.0'
compile 'com.mopub.volley:mopub-volley:1.1.0'
}
Hope this can help you!
Go download the MoPub SDK.
Unzip and you will get a mopub-sdk folder
Navigate to your ‘Project location’, go into your project folder, and drop the unzipped mopub-sdk into the folder.
Navigate back to Android Studio and open your project's settings.gradle file and include the MoPub SDK as a module as shown below. You may need to sync Gradle again in Android Studio to have the ‘mopub-sdk’ show up in the left Project window.
include ':app', ':mopub-sdk'
Open your project's build.gradle file and add jcenter as a repository and the MoPub SDK as a dependency:
repositories {
jcenter()
}
...
dependencies {
compile project(':mopub-sdk')
...
}
For those late to the party:
repositories {
jcenter()
}
dependencies {
compile('com.mopub:mopub-sdk:4.8.0#aar') {
transitive = true
}
}
just make sure you've added jcenter() in the your repositories. fabric does not do this automatically for some reason
It looks like there is no mopub-volley lib into mavencentral or jcenter
So tou can try to use
compile 'com.mcxiaoke.volley:library:1.0.18'
instead of
compile 'com.mopub.volley:mopub-volley:1.1.0'
It helps for me.
I'm using android studio 1.1.0. I've added the parse library to my project successfully in gradle. see screenshots. But when I try to import com.parse.* or type Parse and then Alt(Option) + Enter, IDE gives error. It doesn't find the library. Here is screenshot:
And here is the gradle file that doesn't have sync error. It synched successfully.
From the documentation
1.) Download latest Parse and unzip - Latest is 1.8.2
https://parse.com/downloads/android/Parse/latest
2.) Add the parse-*.jar to your app's libs folder and add the following to the gradle.build file in dependencies
dependencies {
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
}
That should work, works well for me, Android studio version - 1.1.0
In any case if it doesnt, try File-->Invalidate Caches and Restart
After studying the problem for a few days, finally I've found the reason. If I use relative path in gradle, it doesn't work. If I use absolute path it works. Here is the absolute path:
compile files('/Users/farhadrubel/AndroidStudioProjects/android/MyProject/libs/Parse-1.8.2.jar')
You can add the library with it's absolute path easily. Remove it from your gradle file (if it's already added). Then right click on the jar file inside lib. Click on Add As Library from context menu.
I followed using facebook sdk in android studio and since I have a libs folder under my 'app' folder, I tried to import it in there by selecting libs and File-->Import Module. I get this:
I'm able to run ProfilePictureSample, which relies on the facebook module, but not app. Logcat says " java.lang.NoClassDefFoundError: com.facebook.android.Facebook" even though I can verify it's there. I get this messsage even after cutting the facebook module and pasting it into the libs folder. Here is a snippet of app-->build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/Parse-1.5.0/Parse-1.5.0.jar') ...
you don't add it under the libs folder, it can be at the same level as "app". In app/build.gradle, add this line: "compile project(':facebook')"
I'm again lost in this facebook login part for my app. Well what happen is that I downloaded the facebook SDK from the facebook site itself then used eclipse to export the project with gradle to be used for android studio. Now in the project stucture of my main app in android I imported the Module of the facebook that I converted then on dependencies I add the module dependency of facebook in my main app. Now I tried to import the facebook package and it just works fine in my MainActivity. Now after I tried to run it errors appears see screenshot:
I tried using the ./gradle clean for both projects and it cleans just fine but I get an error for the build part. I think something went really wrong after I exported the facebook project in gradle structure. How can I solve this error? Anyone encountered this?
worked for me:
drag and drop the jar file into libs of the project (click ok to copy etc..).
then right click on the jar file -> Add as library.
Then open gradle.build and change:
Before:
dependencies {
compile files('libs/android-support-v4.jar')
}
After:
dependencies {
//compile files('libs/android-support-v4.jar')
compile fileTree(dir: 'libs', include: '*.jar')
}
We encountered the exact same problem at roughly the same time, and this is how I went about resolving it in my case.
Move the Facebook SDK project to some remote location.
Create a new Android library module in the parent Gradle project. It should be setup for Gradle. Call it 'Facebook', say. Check that its Android facet is indeed a library module.
Add all the necessary source, resource, manifest, and property files to this new module in the appropriate locations.
Modify the settings.gradle file of the parent project, so that it contains include ':Facebook', ...
Add the dependency on Facebook to your main project, 'Echo', by opening its build.gradle file and adding compile project(':Facebook') to the dependencies.
Both Echo and Facebook might depend on the android support library by now; remove this dependency from your Echo project. For instance, compile fileTree(dir: 'libs', include: '*.jar', exclude: 'android-support-v4.jar'). Check the Facebook.iml file, you want the exported dependency <orderEntry type="library" exported="" name="android-support-v4" level="project" />.
Run ./gradlew clean && ./gradlew build from the parent path.
After this clean up the dependencies in Android Studio, set the absolute apk path for your Echo project in Android Studio. This might not solve everything for you but I think these were the key steps that helped me, especially step 4. All being well you'll be much closer to solving this.
You can try importing Facebook's ant build.xml some where instead and report how you get on, but I found I was getting target redeclaration errors when I already had this error to resolve.