升级Android SDK至33后遇java.io.IOException: null InputStream崩溃求助
Android 升级SDK到33后集成Emarsys SDK启动崩溃问题
我是Android和Java开发新手,正在开发应用并尝试集成Emarsys SDK,该SDK要求应用使用更高版本SDK。但将SDK版本升级至33后,应用启动即崩溃,报错信息如下:
DropBoxUtil pid-9840 [AppErrors] null InputStream [CONTEXT service_id=254 ] java.io.IOException: null InputStream at boqn.c(:com.google.android.gms@230413037@23.04.13 (150400-505809224):23)
以下是我的模块级gradle配置:
apply plugin: 'com.android.application' android { compileSdkVersion 33 defaultConfig { applicationId "io.ionic.starter" minSdkVersion 24 targetSdkVersion 33 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61 ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~' } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { flatDir{ dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs' } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion" implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion" implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion" implementation project(':capacitor-android') testImplementation "junit:junit:$junitVersion" androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion" androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion" implementation project(':capacitor-cordova-android-plugins') //for emersys implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.appcompat:appcompat:1.5.0' //Emarsys implementation 'com.emarsys:emarsys-sdk:3.4.0' implementation 'com.emarsys:emarsys-firebase:+' } apply from: 'capacitor.build.gradle' try { def servicesJSON = file('google-services.json') if (servicesJSON.text) { apply plugin: 'com.google.gms.google-services' } } catch(Exception e) { logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work") }
项目级gradle配置:
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:7.2.1' classpath 'com.google.gms:google-services:4.3.13' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } apply from: "variables.gradle" allprojects { repositories { google() mavenCentral() } } task clean(type: Delete) { delete rootProject.buildDir }
AndroidManifest.xml配置:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.ionic.starter"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:name="io.ionic.starter.MainActivity" android:label="@string/title_activity_main" android:theme="@style/AppTheme.NoActionBarLaunch" android:launchMode="singleTask" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data> </provider> <!-- Emersys--> <meta-data android:name="com.emarsys.mobileengage.notification_color" android:resource="@color/colorPrimary" /> <meta-data android:name="com.emarsys.mobileengage.small_notification_icon" android:resource="@drawable/default_small_notification_icon" /> <service android:name="com.emarsys.service.EmarsysFirebaseMessagingService" android:exported="false"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service> <!-- <provider--> <!-- android:name="com.emarsys.provider.SharedHardwareIdentificationContentProvider"--> <!-- android:authorities="${applicationId}"--> <!-- android:enabled="true"--> <!-- android:exported="true"--> <!-- android:grantUriPermissions="true" />--> </application> <!-- Permissions --> <uses-permission android:name="android.permission.INTERNET" /> </manifest>
我尚未开始集成SDK的具体功能,不清楚问题触发原因,希望获得帮助。
内容的提问来源于stack exchange,提问作者theboyonfire
相关产品推荐
相关产品推荐

