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

前端 未结 5 1653
醉梦人生
醉梦人生 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 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
        }
    

提交回复
热议问题