Provided Gradle Dependency Is AAR not JAR

后端 未结 7 1431
温柔的废话
温柔的废话 2021-02-18 16:07

I have an issue where I\'m trying to include a library in my project called the ParseLoginUI.

The issue is it uses the provided tag instead of compile. I b

7条回答
  •  长发绾君心
    2021-02-18 16:58

    After try and error, I found the solution…

    First of all, AAR means android archive library, which is not a JAR. I searched something called facebook-android-sdk-4.0.1.jar, but no luck.

    The trick is download facebook code and add it as a module. Doing that, works perfectly and you can use gradle 1.2.3 with ParseLoginUI.

    Go here: https://developers.facebook.com/docs/android/downloads

    Download: https://developers.facebook.com/resources/facebook-android-sdk-4.0.1.zip Decompress it.

    Go to your own project. -Remove in your ParseLoginUI gradle the reference to Parse

    Press FILE, NEW, IMPORT MODULE.

    Select a folder called facebook that is inside the zip you uncompressed.

    Call that module facebook-android-sdk-4.0.1.

    Now add in your parseloginui a dependency to that module, using:

    compile project(':facebook-android-sdk-4.0.1’)
    

    You also have to copy a file from the zip you downloaded to the new module folder, the file is gradle.properties. The one that has:

    ANDROID_BUILD_MIN_SDK_VERSION=9
    
    ANDROID_BUILD_TARGET_SDK_VERSION=21
    
    ANDROID_BUILD_TOOLS_VERSION=21.1.2
    
    ANDROID_BUILD_SDK_VERSION=21
    

    That’s all.

    Press SYNCHRONIZE and cross your fingers.

    I worked in my case after several hours playing with gradle and android studio. Let me know if you get it. If you have reference problems (I had), use FILE, PROJECT STRUCTURE to add the jar references to your modules properly. (I wrote them manually and it seems it was a mistake in my parse references, probably one path or symbol, don’t know. Do that using the user interface of android studio will fix the problem). BTW, you can use a version of parse in ParseLoginUI and another more recent in your project (I didn’t test that for facebook version).

    This is what I have in my ParseLoginUI gradle file:

    compile 'com.parse.bolts:bolts-android:1.2.0'
    
    compile 'com.android.support:support-v4:22.0.0'
    
    compile project(':facebook-android-sdk-4.0.1')
    
    compile files('libs/Parse-1.9.1.jar')
    
    compile files('libs/ParseFacebookUtilsV4-1.9.1.jar')
    

    And this is what I have in my app gradle:

    compile 'com.google.android.gms:play-services:7.5.0'
    
    compile project(':facebook-android-sdk-4.0.1')
    
    compile 'com.parse.bolts:bolts-android:1.2.0'
    
    compile files('libs/Parse-1.9.2/Parse-1.9.2.jar')
    
    compile files('libs/Parse-1.9.2/ParseFacebookUtilsV4-1.9.2.jar')
    
    compile project(':ParseLoginUI’)
    

    Note: I use Gradle version 2.4 and android plugin version 1.2.3. Selct that in FILE, PROJECT STRUCTURE, PROJECT.

    Good luck.

提交回复
热议问题