问题
I am trying build my application Android version 4 and below versions but my application not showing UI designing in below 4 version mobiles
Above 4 version mobiles designing is showing and remaining also working fine can some one help me please.
And i am getting to may crashes once open application which are related to material designing items below 4 version mobiles
Gradle:-
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:
Just add name under application tag in manifest as MultiDexApplication
<application
....
android:name="android.support.multidex.MultiDexApplication"
...
</application>
EDIT
In your case, just add below code snippet in your existing Application Tag
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
来源:https://stackoverflow.com/questions/47884568/material-designing-not-supporting-in-android-4-and-below-versions