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

Application get crashed #2520

Closed
vaibhav1601 opened this issue May 17, 2021 · 3 comments
Closed

Application get crashed #2520

vaibhav1601 opened this issue May 17, 2021 · 3 comments
Labels
closing soon Issue will auto-close if there is no additional activity within 7 days. pinpoint Issues with the AWS Android SDK for Pinpoint. question General question

Comments

@vaibhav1601
Copy link

Screenshot 2021-05-17 at 12 03 35 PM

For your reference I will give additional information on the issue below.

1) While during unit testing we observe that when an application installs for the first time on a specific (android OS 10+) version app gets  crashed.
When further investigating that issue we identified it is related to database permission issues. which mentioned previous mail.i.e
E/SQLiteLog: (1032) statement aborts at 10: [INSERT INTO pinpointevent(event_json,event_size) VALUES (?,?)] attempt to write a readonly database
E/SQLiteLog: (1032) statement aborts at 6: [DELETE FROM pinpointevent WHERE event_id=1] attempt to write a readonly database.

While investigating we came some observations.

  • 1) At the time of  Application install showed awspinpoint.db  Database in Database inspector.
  • 2) Databases  have one table named  pinpointevent. 
  • 3) Some values are shown in that table. 
event_id event_size event_json
1 685 {"class":"com.amazonaws.mobileconnectors.pinpoint.analytics.AnalyticsEvent","hashCode":"e8fef0c","event_id":"d68c3e0a-992f-4d58-b4f6-de2ef06052ba","event_type":"_session.start","unique_id":"5eb0c031-abe4-45e9-bd01-a4a00453beba","timestamp":1620925606104,"platform":"ANDROID","platform_version":"11","make":"Google","model":"sdk_gphone_x86_arm","locale":"en_US","carrier":"Android","session":{"id":"0453beba-20210513-170646101","startTimestamp":1620925606101},"sdk_version":"2.19.2","sdk_name":"aws-sdk-android","app_version_name":"5.0.10","app_version_code":"144","app_package_name":"com.peelworks.android.storeslitepo","app_title":"Taikee","app_id":"abbd0ec6fdaa4bd99fe61c70cd3f87ce"}
2 685 {"class":"com.amazonaws.mobileconnectors.pinpoint.analytics.AnalyticsEvent","hashCode":"cdfa279","event_id":"43e76c24-0d7f-4540-b009-81120ad2b25a","event_type":"_session.start","unique_id":"79fd416f-c928-44d3-878c-a35906860ded","timestamp":1620925730655,"platform":"ANDROID","platform_version":"11","make":"Google","model":"sdk_gphone_x86_arm","locale":"en_US","carrier":"Android","session":{"id":"06860ded-20210513-170850654","startTimestamp":1620925730654},"sdk_version":"2.19.2","sdk_name":"aws-sdk-android","app_version_name":"5.0.10","app_version_code":"144","app_package_name":"com.peelworks.android.storeslitepo","app_title":"Taikee","app_id":"abbd0ec6fdaa4bd99fe61c70cd3f87ce"}



  •  An exception occurred i.e attempt to write a readonly database.  Then an application crashed.
  • Our Application is smoothly working on below (Android 10) OS versions.

2) Please find the attachment of the database and screenshot . 

3) we are using versions below 

  • implementation 'com.amplifyframework:core:1.6.4'
  • implementation 'com.amplifyframework:aws-analytics-pinpoint:1.6.4'
  • implementation 'com.amplifyframework:aws-auth-cognito:1.6.4'


Device information:  
  • Android 10 (API level 29)
  • Android 11 (API level 30)

@richardmcclellan
Copy link
Contributor

Hmm, I've seen a similar error (SQLiteReadOnlyDatabaseException) before when running some of our DataStore unit tests. I was able to solve it by adding some cleanup logic in an @After method, that gets run after each test. Perhaps you could add something similar?

In order to help further, please provide the code that you are using to call the AWS libraries.

@vaibhav1601
Copy link
Author

Hi @richardmcclellan,

Thank you for opinion it not workable for me because I'am not used datastore any where in my project.

    try {
        AmplifyConfiguration config = AmplifyConfiguration.builder(getApplicationContext()).devMenuEnabled(false).build();
        // Add these lines to add the AWSCognitoAuthPlugin and AWSPinpointAnalyticsPlugin plugins
        Amplify.addPlugin(new AWSCognitoAuthPlugin());
        Amplify.addPlugin(new AndroidLoggingPlugin(LogLevel.VERBOSE));
        StrictMode.enableDefaults();
        Amplify.addPlugin(new AWSPinpointAnalyticsPlugin(this));
        Amplify.configure(config, getApplicationContext());
        Log.i("MyAmplifyApp", "Initialized Amplify");
    } catch (AmplifyException error) {
        Log.e("MyAmplifyApp", "Could not initialize Amplify", error);
    }
    getPinpointManager(getApplicationContext());

public static PinpointManager getPinpointManager(final Context applicationContext) {
    if (pinpointManager == null) {
        final AWSConfiguration awsConfig = new AWSConfiguration(applicationContext);
        AWSMobileClient.getInstance().initialize(applicationContext, awsConfig, new Callback<UserStateDetails>() {
            @Override
            public void onResult(UserStateDetails userStateDetails) {
                Log.i("INIT>>>>", String.valueOf(userStateDetails.getUserState()));
            }

            @Override
            public void onError(Exception e) {
                Log.e("INIT", "Initialization error.", e);
            }
        });

        PinpointConfiguration pinpointConfig = new PinpointConfiguration(
                applicationContext,
                AWSMobileClient.getInstance(),
                awsConfig);

        pinpointManager = new PinpointManager(pinpointConfig);


        FirebaseMessaging.getInstance().getToken()
                .addOnCompleteListener(new OnCompleteListener<String>() {
                    @Override
                    public void onComplete(@NonNull Task<String> task) {
                        if (!task.isSuccessful()) {
                            Log.w(TAG, "Fetching FCM registration token failed", task.getException());
                            return;
                        }

                        // Get new FCM registration token
                        String token = task.getResult();

                        // Log and toast
                        Log.d(TAG, token);

                        pinpointManager.getNotificationClient().registerDeviceToken(token);
                    }
                });


     /*   FirebaseInstanceId.getInstance().getInstanceId()
                .addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
                    @Override
                    public void onComplete(@NonNull Task<InstanceIdResult> task) {
                        if (!task.isSuccessful()) {
                            Log.w("TAG", "getInstanceId failed", task.getException());
                            return;
                        }
                        final String token = task.getResult().getToken();
                        Log.d("TAG", "Registering push notifications token: " + token);
                        pinpointManager.getNotificationClient().registerDeviceToken(token);
                    }
                });*/
    }
    return pinpointManager;
}

@poojamat
Copy link
Contributor

@poojamat poojamat transferred this issue from aws-amplify/amplify-android Jun 16, 2021
@poojamat poojamat added pinpoint Issues with the AWS Android SDK for Pinpoint. question General question closing soon Issue will auto-close if there is no additional activity within 7 days. labels Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing soon Issue will auto-close if there is no additional activity within 7 days. pinpoint Issues with the AWS Android SDK for Pinpoint. question General question
Projects
None yet
Development

No branches or pull requests

3 participants