Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error creating Gigya SDK #14

Open
kidandcat opened this issue Aug 16, 2021 · 19 comments
Open

Error creating Gigya SDK #14

kidandcat opened this issue Aug 16, 2021 · 19 comments

Comments

@kidandcat
Copy link

kidandcat commented Aug 16, 2021

I'm getting this error when creating a release APK:

E/AndroidRuntime(13063): java.lang.RuntimeException: Unable to start activity ComponentInfo{es.sonypictures.reactions/es.sonypictures.reactions.MainActivity}: java.lang.RuntimeException: Error creating Gigya SDK (did you forget to Gigya.setApplication or missing apiKey?)
E/AndroidRuntime(13063):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3322)
E/AndroidRuntime(13063):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3471)
E/AndroidRuntime(13063):        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
E/AndroidRuntime(13063):        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime(13063):        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime(13063):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2058)
E/AndroidRuntime(13063):        at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(13063):        at android.os.Looper.loop(Looper.java:226)
E/AndroidRuntime(13063):        at android.app.ActivityThread.main(ActivityThread.java:7592)
E/AndroidRuntime(13063):        at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(13063):        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
E/AndroidRuntime(13063):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

I've tried configuring Gigya's ApiKey using the two methods available:

https://sap.github.io/gigya-android-sdk/sdk-core/
I've configured the Gigya SDK following the instructions, and it works when running in debug mode.

@tal-mi
Copy link
Member

tal-mi commented Aug 25, 2021

Sorry for the delayed response.
I will investigate the issue and update as soon as I can.

@tal-mi
Copy link
Member

tal-mi commented Aug 26, 2021

Where did you put the following line of code?
Gigya.setApplication(this);

@kidandcat
Copy link
Author

kidandcat commented Aug 26, 2021

In development mode it works without that line.

But I put it here to try (although it still doesn't work in release mode):
image

We had all the commented code previowsly, but after upgrading the plugin we removed it and it still works in develop mode.

The problem happens only when running in release mode or creating a release APK.

@tal-mi
Copy link
Member

tal-mi commented Aug 26, 2021

Yes. from the latest version "setApplication" is not needed as the plugin handles the SDK initialization.
I will continue to investigate the issue and update as soon as I can.

Are you using: minifyEnabled true?

@kidandcat
Copy link
Author

kidandcat commented Aug 31, 2021

I don't think so, I'll check it again.

Edit: no, it is not enabled

@tal-mi
Copy link
Member

tal-mi commented Aug 31, 2021

Please attach the following so I can inspect it better:

  1. A detailed log/error of the release build process.
  2. Release build steps (apk/bundle...).

Thanks

@kidandcat
Copy link
Author

kidandcat commented Aug 31, 2021

Build output:
build.txt

build.gradle:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 30

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        applicationId "es.sonypictures.reactions"
        minSdkVersion 24
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
   }

    buildTypes {
        debug {
           signingConfig signingConfigs.release
        }
        release {
           signingConfig signingConfigs.release
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'android.arch.work:work-runtime:1.0.0'
    implementation project(":fluzo-sdk-2.2.0-PRO")
    implementation "androidx.core:core-ktx:+"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.facebook.android:facebook-android-sdk:5.+'
}

@tal-mi
Copy link
Member

tal-mi commented Aug 31, 2021

Can you also provide detailed log of the error?

Thanks.

@kidandcat
Copy link
Author

That was a cached build, this is a clean one:
build.txt

Regarding the error, what I post in the first message is all I get. And it only happens when running the release APK or running flutter in release mode (but then I don't have any logs, it just crashes)

@tal-mi
Copy link
Member

tal-mi commented Aug 31, 2021

Please try to add the following and update me if anything changes.

buildTypes {
        debug {
           signingConfig signingConfigs.release
        }
        release {
           shrinkResources false
           minifyEnabled false
           signingConfig signingConfigs.release
        }
    }

@kidandcat
Copy link
Author

kidandcat commented Aug 31, 2021

It's working with these options, thanks!

Maybe minifying or shrinking is removing the json config of Gigya? Is there any way of having it working with shrinking?

@tal-mi
Copy link
Member

tal-mi commented Aug 31, 2021

Okay. I will investigate further to see why theses options are necessary.
The Gigya core SDK currently does not support shrinking (its a feature that will be added).
I will see what can be done to prioritize it.
Thanks you.

@kidandcat
Copy link
Author

Is not a top priority anyway. I'm closing this issue, but it would be great to have the no shrink option in the documentation.

Thanks for the quick response!

@kidandcat
Copy link
Author

Any news on this? We are shipping our app to production and without shrinking and minify the app size is unmanageable (>200MB).

@kidandcat kidandcat reopened this Oct 9, 2021
@tal-mi
Copy link
Member

tal-mi commented Oct 9, 2021

Shrinking support is not scheduled for Q4 this year.
You can try initializing the SDK via the new initSDK feature added last version.

@KarlChow92
Copy link

Encountering same issue unfortunately.

@John-Dormevil
Copy link

This error is produce without shrinking MissingPluginException(No implementation found for method initSdk on channel gigya_flutter_plugin)

@pwa-tapptic
Copy link

This error is produce without shrinking MissingPluginException(No implementation found for method initSdk on channel gigya_flutter_plugin)

Same here. Have you found a workaround for this?

@pwa-tapptic
Copy link

Not found it in the doc but I checked example app and I fixed the issue by adding manually two dependencies in build.gradle

    implementation 'androidx.appcompat:appcompat:1.5.1'
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants