avivais / phonegap-parse-plugin

Phonegap 3.0.0 plugin for Parse.com push service
195 stars 315 forks source link

Android plugin crashes app #78

Open gexplorer opened 9 years ago

gexplorer commented 9 years ago

After adding the plugin to a working project while executing cordova run android I get a the app has stopped message.

AeroHil commented 9 years ago

I am getting the same issue. Also, crashes with devices running Android 5.1+

mwthinker commented 9 years ago

I had a similar problem, solved it by adding the code stated in Android Quirks in the README.md file.

AeroHil commented 9 years ago

ah. thanks@mwthinker. that helped. (Though I did try that before posting this, but gave up too fast...) For those of you still looking at this problem (or similar), this is what I found:

Doing the Android Quirks note with a Cordova app, you actually have to MAKE the App.java class and put it somewhere inside your android/src folder with the proper package name. Then add the xml attribute 'android:name' as part of the 'application' tag of the AndroidManifest.xml.

Don't do what I did, which is put it inside the MainActivity.java class and fails to compile, then give up...

Also note that, if you do 'cordova platform remove android' then add it back again, this file will be deleted. You would need to add it again (for those of you, like me, who do not check in the 'platforms' folder into git)

opedrero commented 9 years ago

I add App.java file with this code:

package com.editartgroup.ldi;

import android.app.Application;
import org.apache.cordova.core.ParsePlugin;

public class App extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        ParsePlugin.initializeParseWithApplication(this);
    }

}

And I add tag in application AndroidManifest.xml:

 <application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:name="com.editartgroup.ldi.App" android:supportsRtl="true">

but when i try cordova run android:

platforms/android/src/com/editartgroup/ldi/App.java:11: error: cannot find symbol
        ParsePlugin.initializeParseWithApplication(this);
                   ^
  symbol:   method initializeParseWithApplication(App)
  location: class ParsePlugin
1 error
:compileDebugJava FAILED

Can you help me please?

Thanks 4 all!!!

AeroHil commented 9 years ago

That's exactly what I have, so the only thing I can think of is you might have a different version of the ParsePlugin?

Also make sure you have the org directory in your build

screen shot 2015-10-27 at 9 00 12 pm
opedrero commented 8 years ago

I finally use another plugin ( https://github.com/taivo/parse-push-plugin ), thks for your answer