在kitkat设备上开始活动

尝试使用context.startActivity(intent)打开活动时会引发这种情况

 java.lang.TypeNotPresentException: Type android/support/v4/app/ActivityCompat$SharedElementCallback23Impl not present 

所有的活动扩展AppCompatActivity ,我在我的应用程序的静态块内调用AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)

在较新的Android版本everyting是好的。

有人遇到这个问题,可以分享如何解决它的信息?

在这里我的gradle配置

 apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { lintOptions { disable 'RestrictedApi' } signingConfigs { release { keyAlias '****' keyPassword '*************' storeFile file('../release.jks') storePassword '*************' } } compileSdkVersion 26 buildToolsVersion "26.0.2" defaultConfig { applicationId "***.****" minSdkVersion 19 targetSdkVersion 26 versionCode 8 versionName "1.0.3" vectorDrawables.useSupportLibrary true multiDexEnabled true renderscriptTargetApi 26 renderscriptSupportModeEnabled true signingConfig signingConfigs.release } packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } buildTypes { release { signingConfig signingConfigs.release minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { signingConfig signingConfigs.release minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { mavenCentral() jcenter() } maven { url 'https://maven.google.com' // Alternative URL is 'https://dl.google.com/dl/android/maven2/' } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile project(':googleemoji') compile('com.google.api-client:google-api-client-android:1.22.0') { exclude module: 'httpclient' exclude group: 'org.apache.httpcomponents' } compile('com.google.http-client:google-http-client-gson:1.22.0') { exclude module: 'httpclient' } compile('com.google.apis:google-api-services-gmail:v1-rev44-1.22.0') { exclude group: 'org.apache.httpcomponents' } compile 'com.google.firebase:firebase-auth:11.4.0' compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" //noinspection GradleCompatible compile 'com.android.support:appcompat-v7:26.1.0' compile 'com.android.support:customtabs:26.1.0' compile 'com.android.support:support-vector-drawable:26.1.0' compile 'com.android.support:design:26.1.0' compile 'com.android.support:cardview-v7:26.1.0' compile 'com.android.support:recyclerview-v7:26.1.0' compile 'com.google.android.gms:play-services-identity:11.4.0' compile 'com.google.firebase:firebase-messaging:11.4.0' compile 'com.google.code.gson:gson:2.8.0' compile 'com.google.android.gms:play-services-auth:11.4.0' compile 'com.google.android.gms:play-services-plus:11.4.0' compile 'com.squareup.okhttp:okhttp:2.0.0' compile 'com.android.support:multidex:1.0.1' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'commons-io:commons-io:2.5' compile 'com.google.android.gms:play-services-location:11.4.0' compile 'com.google.firebase:firebase-invites:11.4.0' } kotlin { experimental { coroutines "enable" } } apply plugin: 'com.google.gms.google-services'