skip to Main Content

I am very new to android and java development.

I am trying to devlop an app and integrate one SDK from Emarsys.. This SDK requires the app to use higher sdk version.

But after changing the SDK version to the higher version (33), I have an error and the app is always being terminated immediately..

 DropBoxUtil             pid-9840  [AppErrors] null InputStream [CONTEXT service_id=254 ]
                                                                                                    java.io.IOException: null InputStream
                                                                                                        at boqn.c(:com.google.android.gms@[email protected] (150400-505809224):23)

Here is my gradle.bundle

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 in project

// 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
}

and here is the manifest

<?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>

I am not sure what causing it, because I haven’t even started to integrate the service from SDK..

2

Answers


  1. Chosen as BEST ANSWER

    I fixed this issue by taking lower version of the Emersys SDK :)


  2. In build.gradle (project), update Google Service dependency to

    classpath 'com.google.gms:google-services:4.3.15'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search