Importing Facebook library in Android Studio: Could not find property 'ANDROID_BUILD_SDK_VERSION'

前端 未结 5 1633
醉梦人生
醉梦人生 2020-12-03 00:18

I want to import a library project into my app but whenever I try to do so , Android Studio doesn\'t recognise it

It also gives me errors in build.gradle ..

Th

相关标签:
5条回答
  • 2020-12-03 00:52

    Go the facebook folder which you have imported in your project. Copy the gradle.properties file and paste in into your facebook module.It will remove the errors.

    0 讨论(0)
  • 2020-12-03 00:57
    apply plugin: 'com.android.library'
    
    android {
        compileSdkVersion 22
        buildToolsVersion "22.0.1"
    
        defaultConfig {
            minSdkVersion 8
            targetSdkVersion 4
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
        }
    }
    
    dependencies {
        compile 'com.android.support:appcompat-v7:22.2.1'
    }
    
    0 讨论(0)
  • 2020-12-03 01:02

    EDIT

    There is also a GUI way for doing this. It is accessed by selecting the module facebook in the project tree and pressing f4.
    Also you can just right-click the facebook and go to Open Module Settings near the bottom.

    It is shown in the pictures. The numbers in the picture are top sdk version at the time of writing.

    first block - The numbers in the pictures don't match the above ones, but that's because I updated them later on.

    second block - same update

    There is a simpler solution. The constants like ANDROID_BUILD_SDK_VERSION can be replaced with normal version "numbers". So instead of

    android {
        compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
        buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
    
        defaultConfig {
             minSdkVersion 8
             targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
        }
    

    ..file can look like this:

    android {
        compileSdkVersion 19
        buildToolsVersion '19.1.0'
    
        defaultConfig {
             minSdkVersion 15
             targetSdkVersion 19
        }
    
    0 讨论(0)
  • 2020-12-03 01:07

    First of all, you can add this dependency to your project, without compiling the lib locally.

    dependencies {
        compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
    }
    

    Otherwise if you would like to compile this lib locally, you have to define these keys in gradle.properties in the root.

    ANDROID_BUILD_TARGET_SDK_VERSION=19
    ANDROID_BUILD_TOOLS_VERSION=19
    ANDROID_BUILD_SDK_VERSION=19
    
    0 讨论(0)
  • 2020-12-03 01:09

    For those who ran into same problems while adding libraries and still can't get it work. The following local include of the .aar file worked for me:

    • Just download the .aar file from the maven repo manually.
    • In Android Studio go to File -> new Module -> import .JAR or .AAR package and select your downloaded .aar file.

    Android Studio does the rest (in the build.gradle) for you. Maybe clean and rebuild your project.

    0 讨论(0)
提交回复
热议问题