elizabethrego / cordova-plugin-instabug

Integrate the Instabug SDK in your hybrid app.
14 stars 5 forks source link

Instabug.getInstance() not public #5

Closed monove closed 8 years ago

monove commented 8 years ago

I just communicated with Instabug as I was getting a bug: Instabug.getInstance(); is not a public method.

They replied: We stopped using Instabug.getInstance() since v2 of instabug. Now you should use only Instabug. directly.

AilisObrian commented 8 years ago

happens to me!

/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:213: error: getInstance() is not public in Instabug; cannot be accessed from outside package
            Instabug instabug = Instabug.getInstance();
                                        ^
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:235: error: getInstance() is not public in Instabug; cannot be accessed from outside package
            Instabug.getInstance().showIntroMessage();
                    ^
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:269: error: getInstance() is not public in Instabug; cannot be accessed from outside package
                    Instabug.getInstance().setPrimaryColor(hexColor);
                            ^
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:291: error: getInstance() is not public in Instabug; cannot be accessed from outside package
                Instabug.getInstance().setUserEmail(email);
                        ^
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:310: error: getInstance() is not public in Instabug; cannot be accessed from outside package
                Instabug.getInstance().setUsername(name);
                        ^
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:329: error: getInstance() is not public in Instabug; cannot be accessed from outside package
                Instabug.getInstance().setUserData(data);
                        ^
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:371: error: getInstance() is not public in Instabug; cannot be accessed from outside package
                    Instabug.getInstance().setFileAttachment(uri);
                            ^
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:371: error: method setFileAttachment in class Instabug cannot be applied to given types;
                    Instabug.getInstance().setFileAttachment(uri);
                                          ^
  required: Uri,String
  found: Uri
  reason: actual and formal argument lists differ in length
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:395: error: getInstance() is not public in Instabug; cannot be accessed from outside package
                Instabug.getInstance().log(log);
                        ^
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:411: error: getInstance() is not public in Instabug; cannot be accessed from outside package
            Instabug.getInstance().clearLog();
                    ^
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:431: error: getInstance() is not public in Instabug; cannot be accessed from outside package
                Instabug.getInstance().changeInvocationEvent(iEvent);
                        ^
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:447: error: getInstance() is not public in Instabug; cannot be accessed from outside package
            Instabug.getInstance().disable();
                    ^
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:462: error: getInstance() is not public in Instabug; cannot be accessed from outside package
            Instabug.getInstance().enable();
                    ^
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:477: error: getInstance() is not public in Instabug; cannot be accessed from outside package
            boolean enabled = Instabug.getInstance().isEnabled();
                                      ^
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:492: error: getInstance() is not public in Instabug; cannot be accessed from outside package
            boolean invoked = Instabug.getInstance().isSDKInvoked();
                                      ^
/Users/obrian/projects/bcapp/platforms/android/src/com/wodify/cordova-plugin-instabug/IBPlugin.java:507: error: getInstance() is not public in Instabug; cannot be accessed from outside package
            boolean enabled = Instabug.getInstance().isDebugEnabled();
                                      ^
elizabethrego commented 8 years ago

Hmm. This was definitely in their API reference at the time I wrote this plugin - however, that was right around the time v3 was released, and their documentation for that version was not yet publicly available (they sent me what they had so far). I can look into this, but probably not in a timely fashion.

monove commented 8 years ago

I got this from their support: in Instabug v2, you set the invocation mode during initializing instabug in you Application class, you can change it anytime via Instabug.changeInvocationEvent() and you don't have to get instance of instabug just use Instabug. Does that help?

elizabethrego commented 8 years ago

Not quite, but based on your first comment it looks like we may be able to replace each instance of Instabug.getInstance() simply with Instabug?

monove commented 8 years ago

It compiled until it hit Instabug.setFileAttachment(uri) it then threw an error like actual and formal argument lists differ in length

monove commented 8 years ago
error: method setFileAttachment in class Instabug cannot be applied to given types;
                    Instabug.setFileAttachment(uri);
                            ^
  required: Uri,String
  found: Uri
  reason: actual and formal argument lists differ in length
monove commented 8 years ago

I've just tested the referenced commit (sorry about the messy commit message, uploaded before I finished).

monove commented 8 years ago

hmmm, even with the referenced commit i am getting:

--------- beginning of crash
06-08 12:57:44.795  5073  5073 E AndroidRuntime: FATAL EXCEPTION: main
06-08 12:57:44.795  5073  5073 E AndroidRuntime: Process: com.app.my, PID: 5073
06-08 12:57:44.795  5073  5073 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate receiver com.instabug.library.network.InstabugNetworkReceiver: java.lang.ClassNotFoundException: Didn't find class "com.instabug.library.network.InstabugNetworkReceiver" on path: DexPathList[[zip file "/data/app/com.app.my-1/base.apk"],nativeLibraryDirectories=[/data/app/com.app.my-1/lib/arm, /vendor/lib, /system/lib]]
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    at android.app.ActivityThread.handleReceiver(ActivityThread.java:2724)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    at android.app.ActivityThread.-wrap14(ActivityThread.java)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1431)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:148)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:5443)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
06-08 12:57:44.795  5073  5073 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.instabug.library.network.InstabugNetworkReceiver" on path: DexPathList[[zip file "/data/app/com.app.my-1/base.apk"],nativeLibraryDirectories=[/data/app/com.app.my-1/lib/arm, /vendor/lib, /system/lib]]
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    at android.app.ActivityThread.handleReceiver(ActivityThread.java:2719)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    ... 8 more
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    Suppressed: java.lang.ClassNotFoundException: com.instabug.library.network.InstabugNetworkReceiver
06-08 12:57:44.795  5073  5073 E AndroidRuntime:        at java.lang.Class.classForName(Native Method)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
06-08 12:57:44.795  5073  5073 E AndroidRuntime:        ... 10 more
06-08 12:57:44.795  5073  5073 E AndroidRuntime:    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
06-08 12:57:44.817  2227  2241 I ActivityManager: Start proc 5091:com.metago.astro/u0a102 for broadcast com.metago.astro/com.inmobi.commons.analytics.androidsdk.IMAdTrackerReceiver
06-08 12:57:44.844  2227  4609 I ActivityManager: Killing 4282:com.google.android.setupwizard/u0a40 (adj 15): empty #7
06-08 12:57:44.898  2227  3366 I ActivityManager: Process com.app.my (pid 5073) has died
elizabethrego commented 8 years ago

Yeah, seems like the whole API has changed. This definitely worked at the time of writing ;)

I will consider updating this, but Instabug is supposed to be releasing their own official Cordova plugin, so I'll have to check in with them to learn about a timeline and see if it's worth it.