材料设计不支持android 4及以下版本

时间:2017-12-19 10:11:14

标签: android material-design

我正在尝试构建我的应用程序Android版本4及更低版本,但我的应用程序未在以下4版本手机中显示UI设计

以上4个版本的手机设计正在显示并且保持也工作正常可以帮助我。

我可能会崩溃一旦打开应用程序与4版本手机下面的材料设计项目有关

摇篮: -

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.karvyclick.fos"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 4
        versionName "1.3"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    aaptOptions {
        cruncherEnabled = false
    }

    useLibrary 'org.apache.http.legacy'
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }

    defaultConfig{
        vectorDrawables.useSupportLibrary = true
    }

    dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries = false
        jumboMode true
    }
    sourceSets { main { res.srcDirs = ['src/main/res', 'src/main/res/anim'] } }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'com.google.code.gson:gson:2.7'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    testCompile 'junit:junit:4.12'
    //noinspection GradleCompatible
    compile 'com.android.support:design:26.0.0-alpha1'
    compile 'com.android.support:cardview-v7:26.0.0-alpha1'
    compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
    //noinspection GradleCompatible
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.google.firebase:firebase-core:9.4.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile('org.apache.httpcomponents:httpmime:4.3.6') {
        exclude module: 'httpclient'
    }
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
    compile 'com.squareup.picasso:picasso:2.3.2'
    compile 'com.cocosw:bottomsheet:1.+@aar'
    compile 'com.baoyz.pullrefreshlayout:library:1.2.0'
}
apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:0)

只需在清单中的name标记下添加applicationMultiDexApplication

<application
        ....
        android:name="android.support.multidex.MultiDexApplication"
        ...
</application>

修改

在您的情况下,只需在现有的应用程序标记中添加以下代码段

即可
@Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }