Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

App crash after Android Studio 2.1.1 update #911

Closed
Jojr opened this issue May 20, 2016 · 9 comments
Closed

App crash after Android Studio 2.1.1 update #911

Jojr opened this issue May 20, 2016 · 9 comments

Comments

@Jojr
Copy link

Jojr commented May 20, 2016

App crash when compiled with last version of Android Studio 2.1.1

I just update the Android Studio, then the trouble starts.
No crashes if no calls to function.

Same code of before, just run a new compilation

document.addEventListener("deviceready",pushFunc,false);

        function pushFunc(){
                console.log("Device Ready")

                var push = PushNotification.init({
                    android: {
                        senderID: "XXXXXXXXXXXXX"
                    },
                    ios: {
                        alert: "true",
                        badge: "true",
                        sound: "true"
                    },
                    windows: {}
                });

                push.on('registration', function(data) {
                    // data.registrationId
                    console.log(data.registrationId);
                    alert(data.registrationId);
                });
    push.on('error', function(e) {
            console.log(e.message);
            });
        }

ADB logcat:

05-20 15:09:12.107  4475  4475 V PushPlugin: execute: action=init

05-20 15:09:12.107  4475  4511 V PushPlugin: execute: data=[{"android":{"senderID":"xxxxxxxxxxxxx"},"ios":{"sound":"true","alert":"true","badge":"true"},"windows":{}}]

05-20 15:09:12.107  4475  4511 V PushPlugin: execute: jo={"senderID":"xxxxxxxxxxxxx"}

05-20 15:09:12.107  4475  4511 V PushPlugin: execute: senderID=xxxxxxxxxxxxx

05-20 15:09:12.117  4475  4511 D dalvikvm: DexOpt: wanted instance, got static for method Landroid/support/v4/content/ContextCompat;.getNoBackupFilesDir

05-20 15:09:12.117  4475  4511 I dalvikvm: Could not find method android.support.v4.content.ContextCompat.getNoBackupFilesDir, referenced from method com.google.android.gms.iid.zzd.zzeC

05-20 15:09:12.117  4475  4511 W dalvikvm: VFY: unable to resolve virtual method 3458: Landroid/support/v4/content/ContextCompat;.getNoBackupFilesDir (Landroid/content/Context;)Ljava/io/File;

05-20 15:09:12.117  4475  4511 D dalvikvm: VFY: replacing opcode 0x6e at 0x0007

05-20 15:09:12.117  4475  4488 D GCAndroid: (0x4fd04050) deconstrcutor

05-20 15:09:12.117  4475  4511 W dalvikvm: threadid=20: thread exiting with uncaught exception (group=0x41af97d0)

05-20 15:09:12.127  4475  4488 D GCAndroid: (0x555044c0) deconstrcutor

05-20 15:09:12.127  4475  4511 E AndroidRuntime: FATAL EXCEPTION: pool-1-thread-3

05-20 15:09:12.127  4475  4511 E AndroidRuntime: java.lang.IncompatibleClassChangeError: android.support.v4.content.ContextCompat

05-20 15:09:12.127  4475  4511 E AndroidRuntime:    at com.google.android.gms.iid.zzd.zzeC(Unknown Source)

05-20 15:09:12.127  4475  4511 E AndroidRuntime:    at com.google.android.gms.iid.zzd.<init>(Unknown Source)

05-20 15:09:12.127  4475  4511 E AndroidRuntime:    at com.google.android.gms.iid.zzd.<init>(Unknown Source)

05-20 15:09:12.127  4475  4511 E AndroidRuntime:    at com.google.android.gms.iid.InstanceID.zza(Unknown Source)

05-20 15:09:12.127  4475  4511 E AndroidRuntime:    at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)

05-20 15:09:12.127  4475  4511 E AndroidRuntime:    at com.adobe.phonegap.push.PushPlugin$1.run(PushPlugin.java:73)

05-20 15:09:12.127  4475  4511 E AndroidRuntime:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)

05-20 15:09:12.127  4475  4511 E AndroidRuntime:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)

05-20 15:09:12.127  4475  4511 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:856)

05-20 15:09:12.127   382   603 W ActivityManager:   Force finishing activity br.com.infosector.servicoemcampo/.MainActivity

05-20 15:09:12.177  4475  4488 D GCAndroid: (0x4fd04050) deconstrcutor

05-20 15:09:12.177   382   405 W ApplicationContext: Unable to create files directory files

05-20 15:09:12.197  4475  4475 W IMGSRV  : :0: gralloc_unregister_buffer: ID: 97 handle: 0x55532dc0 size: 513 x 72 fmt: 5 usage: 0xb00

05-20 15:09:12.197  4475  4475 W IMGSRV  : :0: gralloc_unregister_buffer: ID: 100 handle: 0x559e4bf0 size: 513 x 72 fmt: 5 usage: 0xb00

05-20 15:09:12.197  4475  4475 W IMGSRV  : :0: gralloc_unregister_buffer: ID: 102 handle: 0x53cf8420 size: 513 x 72 fmt: 5 usage: 0xb00

05-20 15:09:12.197   382   789 W IMGSRV  : :0: gralloc_device_free: ID: 102 handle: 0x5bee3730 size: 513 x 72 fmt: 5 usage: 0xb00

05-20 15:09:12.207   382   394 W IMGSRV  : :0: gralloc_device_free: ID: 97 handle: 0x5bedebd0 size: 513 x 72 fmt: 5 usage: 0xb00

05-20 15:09:12.207   382   405 D BroadcastQueue: An activity is being launched, pause the current intent dispatch

05-20 15:09:12.217   382   405 W IMGSRV  : :0: gralloc_device_alloc: ID: 106 handle: 0x59ca6830 size: 388 x 158 fmt: 1 usage: 0x933

05-20 15:09:12.217  4475  4475 W IMGSRV  : :0: gralloc_unregister_buffer: ID: 96 handle: 0x4fd003d0 size: 540 x 888 fmt: 5 usage: 0xb00

05-20 15:09:12.217  4475  4475 W IMGSRV  : :0: gralloc_unregister_buffer: ID: 99 handle: 0x559d7d20 size: 540 x 888 fmt: 5 usage: 0xb00

05-20 15:09:12.217   382   392 W IMGSRV  : :0: gralloc_device_free: ID: 99 handle: 0x5bee2980 size: 540 x 888 fmt: 5 usage: 0xb00

05-20 15:09:12.247   382   405 D BroadcastQueue: An activity is being launched, pause the current intent dispatch

Steps to Reproduce

Android 4.1.2

Motorola Razr i (XT890)

Cordova CLI version and cordova platform version

cordova --version      6.1.1
cordova platform version android        5.1.1

Plugin version 1.6.3

@zimski
Copy link

zimski commented May 20, 2016

I got the same error, exactly the same behaviour

cordova version 5.0.0
android platforms 4.0.0

@zimski
Copy link

zimski commented May 20, 2016

Hi,

I fixed the issue by removing the support of v4 in app/platforms/android/project.properties
Line to remove

cordova.system.library.2=com.android.support:support-v4:+

this file in my case already contains an other version of support

cordova.system.library.3=com.android.support:support-v13:23+

I think the v4 is deprecated for the latest version of service-gcm
The app starts correctly and the register is OK.

If some one can help and explain to me how the project.properties is generated/update ? this will allow us to fix this issue in a cleaner way.

@Jojr
Copy link
Author

Jojr commented May 21, 2016

Thank you by your emergency solution!

This works in my app now.

Is project.properties file generated by Cordova?
If is true, maybe Cordova needs an update to fix this.

@macdonst
Copy link
Member

Duplicate of #909 but thanks for the detailed logs.

@gorancn
Copy link

gorancn commented May 23, 2016

I've managed to "downgrade" android suport-v4 lib to 23.* version with following steps:
1.removing 24.* folders from [android-sdk-location]/extras/android/m2repository/com/android/support/support-v4
2. removing tags for 24.* versions from [android-sdk-location]/extras/android/m2repository/com/android/support/support-v4/maven-metadata.xml
3. update tag in [android-sdk-location]/extras/android/m2repository/com/android/support/support-v4/maven-metadata.xml to latest 23.* version

After these steps I've clean android build folder and build project again. It works fine after these steps.

@macdonst
Copy link
Member

@gorancn can you post this in #909 for other folks to find easier?

@gorancn
Copy link

gorancn commented May 23, 2016

Sure

@jakubskopal
Copy link

I also managed to force downgrading the library by adding the following build-extras.gradle into platforms/android:

configurations.compile {
resolutionStrategy {
force 'com.android.support:support-v4:23.4.0';
}
}

@lock
Copy link

lock bot commented Jun 4, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

5 participants