import android.os.SystemProperties;
提示找不到

第三方应用导包失败

解决办法  导入
layoutlib.jar
AndroidStudio 在/app/build.gradle 添加这段代码到末尾

String SDK_DIR = System.getenv("ANDROID_SDK_HOME")
if (SDK_DIR == null) {
    Properties props = new Properties()
    props.load(new FileInputStream(project.rootProject.file("local.properties")))
    SDK_DIR = props.get('sdk.dir');
}
dependencies {
    provided files("${SDK_DIR}/platforms/android-20/data/layoutlib.jar")
}
如我的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.example.dm"
        minSdkVersion 23
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }



    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }


}

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support:design:26.0.0-beta2'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'

}
String SDK_DIR = System.getenv("ANDROID_SDK_HOME")
if (SDK_DIR == null) {
    Properties props = new Properties()
    props.load(new FileInputStream(project.rootProject.file("local.properties")))
    SDK_DIR = props.get('sdk.dir');
}
dependencies {
    provided files("${SDK_DIR}/platforms/android-20/data/layoutlib.jar")
}







更多推荐