I was trying to use firebase in my Ionic Framework. I added google-services.json for android and GoogleService-Info.plist for iOS. No other code was added to do initialisation.
I'm able to receive the unique device token on iOS but not on Android. I checked the log and it logs firebase API initialisation failure which is crashing the app. Attaching the log, please assist.
06-25 09:06:34.798: D/FirebaseApp(17204): com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
06-25 09:06:34.805: E/FirebaseApp(17204): Firebase API initialization failure.
06-25 09:06:34.805: E/FirebaseApp(17204): java.lang.reflect.InvocationTargetException
06-25 09:06:34.805: E/FirebaseApp(17204): at java.lang.reflect.Method.invoke(Native Method)
06-25 09:06:34.805: E/FirebaseApp(17204): at com.google.firebase.FirebaseApp.zza(Unknown Source)
06-25 09:06:34.805: E/FirebaseApp(17204): at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
06-25 09:06:34.805: E/FirebaseApp(17204): at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
06-25 09:06:34.805: E/FirebaseApp(17204): at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
06-25 09:06:34.805: E/FirebaseApp(17204): at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
06-25 09:06:34.805: E/FirebaseApp(17204): at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
06-25 09:06:34.805: E/FirebaseApp(17204): at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
06-25 09:06:34.805: E/FirebaseApp(17204): at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
06-25 09:06:34.805: E/FirebaseApp(17204): at android.app.ActivityThread.installProvider(ActivityThread.java:5174)
06-25 09:06:34.805: E/FirebaseApp(17204): at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769)
06-25 09:06:34.805: E/FirebaseApp(17204): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709)
06-25 09:06:34.805: E/FirebaseApp(17204): at android.app.ActivityThread.-wrap1(ActivityThread.java)
06-25 09:06:34.805: E/FirebaseApp(17204): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
06-25 09:06:34.805: E/FirebaseApp(17204): at android.os.Handler.dispatchMessage(Handler.java:102)
06-25 09:06:34.805: E/FirebaseApp(17204): at android.os.Looper.loop(Looper.java:148)
06-25 09:06:34.805: E/FirebaseApp(17204): at android.app.ActivityThread.main(ActivityThread.java:5443)
06-25 09:06:34.805: E/FirebaseApp(17204): at java.lang.reflect.Method.invoke(Native Method)
06-25 09:06:34.805: E/FirebaseApp(17204): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
06-25 09:06:34.805: E/FirebaseApp(17204): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
06-25 09:06:34.805: E/FirebaseApp(17204): Caused by: java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/todevs.com.collegemate-2/base.apk)
06-25 09:06:34.805: E/FirebaseApp(17204): at com.google.firebase.iid.zzg.zzeC(Unknown Source)
06-25 09:06:34.805: E/FirebaseApp(17204): at com.google.firebase.iid.zzg.<init>(Unknown Source)
06-25 09:06:34.805: E/FirebaseApp(17204): at com.google.firebase.iid.zzg.<init>(Unknown Source)
06-25 09:06:34.805: E/FirebaseApp(17204): at com.google.firebase.iid.zzd.zzb(Unknown Source)
06-25 09:06:34.805: E/FirebaseApp(17204): at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
06-25 09:06:34.805: E/FirebaseApp(17204): ... 20 more
06-25 09:06:34.808: D/FirebaseApp(17204): com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
06-25 09:06:34.823: I/FA(17204): App measurement is starting up, version: 9080
06-25 09:06:34.823: I/FA(17204): To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
06-25 09:06:34.852: D/FirebaseApp(17204): Initialized class com.google.android.gms.measurement.AppMeasurement.
06-25 09:06:34.852: I/FirebaseInitProvider(17204): FirebaseApp initialization successful
06-25 09:06:34.864: V/GoogleSignatureVerifier(17204): MBEmh/9iFBDAaTCK
06-25 09:06:34.876: D/XWalkLib(17204): Pre init xwalk core in todevs.com.collegemate.MainActivity
06-25 09:06:34.881: D/XWalkLib(17204): Reserve class class org.xwalk.core.XWalkPreferences to todevs.com.collegemate.MainActivity
06-25 09:06:34.882: D/XWalkLib(17204): Reserve method setValue to todevs.com.collegemate.MainActivity
06-25 09:06:34.882: D/XWalkLib(17204): Reserve class class org.xwalk.core.XWalkPreferences to todevs.com.collegemate.MainActivity
06-25 09:06:34.882: D/XWalkLib(17204): Reserve method setValue to todevs.com.collegemate.MainActivity
06-25 09:06:34.882: D/XWalkLib(17204): Reserve class class org.xwalk.core.XWalkPreferences to todevs.com.collegemate.MainActivity
06-25 09:06:34.882: D/XWalkLib(17204): Reserve method setValue to todevs.com.collegemate.MainActivity
06-25 09:06:34.882: D/XWalkLib(17204): Reserve class class org.xwalk.core.XWalkPreferences to todevs.com.collegemate.MainActivity
06-25 09:06:34.882: D/XWalkLib(17204): Reserve method setValue to todevs.com.collegemate.MainActivity
06-25 09:06:34.889: D/XWalkLib(17204): Reserve object class org.crosswalk.engine.XWalkCordovaView to todevs.com.collegemate.MainActivity
06-25 09:06:34.900: D/XWalkLib(17204): Reserve object class org.crosswalk.engine.XWalkCordovaResourceClient to todevs.com.collegemate.MainActivity
06-25 09:06:34.900: D/XWalkLib(17204): Reserve method setResourceClient to todevs.com.collegemate.MainActivity
06-25 09:06:34.901: D/XWalkLib(17204): Reserve object class org.crosswalk.engine.XWalkCordovaUiClient to todevs.com.collegemate.MainActivity
06-25 09:06:34.902: D/XWalkLib(17204): Reserve method setUIClient to todevs.com.collegemate.MainActivity
06-25 09:06:34.906: D/XWalkLib(17204): Reserve method setXWalkViewInternalVisibility to todevs.com.collegemate.MainActivity
06-25 09:06:34.906: D/XWalkLib(17204): Reserve method setSurfaceViewVisibility to todevs.com.collegemate.MainActivity
06-25 09:06:34.976: D/OpenGLRenderer(17204): Use EGL_SWAP_BEHAVIOR_PRESERVED: true
06-25 09:06:35.012: V/StatusBar(17204): StatusBar: initialization
06-25 09:06:35.037: D/FCMPlugin(17204): ==> FCMPlugin initialize
06-25 09:06:35.039: D/AndroidRuntime(17204): Shutting down VM
06-25 09:06:35.039: E/AndroidRuntime(17204): FATAL EXCEPTION: main
06-25 09:06:35.039: E/AndroidRuntime(17204): Process: todevs.com.collegemate, PID: 17204
06-25 09:06:35.039: E/AndroidRuntime(17204): java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/todevs.com.collegemate-2/base.apk)
06-25 09:06:35.039: E/AndroidRuntime(17204): at com.google.firebase.iid.zzg.zzeC(Unknown Source)
06-25 09:06:35.039: E/AndroidRuntime(17204): at com.google.firebase.iid.zzg.<init>(Unknown Source)
06-25 09:06:35.039: E/AndroidRuntime(17204): at com.google.firebase.iid.zzg.<init>(Unknown Source)
06-25 09:06:35.039: E/AndroidRuntime(17204): at com.google.firebase.iid.zzd.zzb(Unknown Source)
06-25 09:06:35.039: E/AndroidRuntime(17204): at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
06-25 09:06:35.039: E/AndroidRuntime(17204): at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
06-25 09:06:35.039: E/AndroidRuntime(17204): at com.google.firebase.messaging.FirebaseMessaging.getInstance(Unknown Source)
06-25 09:06:35.039: E/AndroidRuntime(17204): at com.gae.scaffolder.plugin.FCMPlugin.initialize(FCMPlugin.java:34)
06-25 09:06:35.039: E/AndroidRuntime(17204): at org.apache.cordova.CordovaPlugin.privateInitialize(CordovaPlugin.java:57)
06-25 09:06:35.039: E/AndroidRuntime(17204): at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:172)
06-25 09:06:35.039: E/AndroidRuntime(17204): at org.apache.cordova.PluginManager.startupPlugins(PluginManager.java:98)
06-25 09:06:35.039: E/AndroidRuntime(17204): at org.apache.cordova.PluginManager.init(PluginManager.java:87)
06-25 09:06:35.039: E/AndroidRuntime(17204): at org.apache.cordova.CordovaWebViewImpl.init(CordovaWebViewImpl.java:116)
06-25 09:06:35.039: E/AndroidRuntime(17204): at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:144)
06-25 09:06:35.039: E/AndroidRuntime(17204): at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:214)
06-25 09:06:35.039: E/AndroidRuntime(17204): at todevs.com.collegemate.MainActivity.onCreate(MainActivity.java:32)
06-25 09:06:35.039: E/AndroidRuntime(17204): at android.app.Activity.performCreate(Activity.java:6259)
06-25 09:06:35.039: E/AndroidRuntime(17204): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130)
06-25 09:06:35.039: E/AndroidRuntime(17204): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
06-25 09:06:35.039: E/AndroidRuntime(17204): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490)
06-25 09:06:35.039: E/AndroidRuntime(17204): at android.app.ActivityThread.-wrap11(ActivityThread.java)
06-25 09:06:35.039: E/AndroidRuntime(17204): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)
06-25 09:06:35.039: E/AndroidRuntime(17204): at android.os.Handler.dispatchMessage(Handler.java:102)
06-25 09:06:35.039: E/AndroidRuntime(17204): at android.os.Looper.loop(Looper.java:148)
06-25 09:06:35.039: E/AndroidRuntime(17204): at android.app.ActivityThread.main(ActivityThread.java:5443)
06-25 09:06:35.039: E/AndroidRuntime(17204): at java.lang.reflect.Method.invoke(Native Method)
06-25 09:06:35.039: E/AndroidRuntime(17204): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
06-25 09:06:35.039: E/AndroidRuntime(17204): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
I refactored the plugin and made it working for ionic on both Android and iOS.
https://github.com/guyromb/cordova-plugin-fcm-plus
Make sure you have the latest Xcode, or SDK tools for Android (incl. Google play/services).
go to project.properties file ->
try updating your dependency to compile
com.google.firebase:firebase-messaging:9.0.2
&
com.google.firebase:firebase-core:9.0.2
I believe this bug was fixed in the patches between 9.0.0 and 9.0.2
Related
This is project for video recorder.The only problem I am having is retrieving stored uri of video from sqllite.The project works fine if I don't call retrieveVid() method but it crashes out when retrieveVid() method is called.Here I am trying to retrieve the uri stored at column 1 and row 2 of sqllite database.Inside checkEvents() method I have commented the other codes which I have tried . Problem might be in checkEvents() or getEvents() method or retrieveVid() method.Since I am running the project on mobile as camera doesn't work on my emulator so i don't have logcat.I am not posting SecondActvity.java as it is not related to database or my problem.
logcat
06-25 21:36:24.501: E/CursorWindow(23206): Failed to read row 2, column 1 from a CursorWindow which has 123 rows, 1 columns.
06-25 21:36:24.504: D/AndroidRuntime(23206): Shutting down VM
06-25 21:36:24.504: W/dalvikvm(23206): threadid=1: thread exiting with uncaught exception (group=0x40e89908)
06-25 21:36:24.514: E/AndroidRuntime(23206): FATAL EXCEPTION: main
06-25 21:36:24.514: E/AndroidRuntime(23206): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=200, result=-1, data=Intent { dat=file:///storage/sdcard0/Pictures/Hello Camera/VID_20140625_213611.mp4 }} to activity {com.example.Assignment/com.example.Assignment.MainActivity}: java.lang.IllegalStateException: Couldn't read row 2, col 1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
06-25 21:36:24.514: E/AndroidRuntime(23206): at android.app.ActivityThread.deliverResults(ActivityThread.java:3302)
06-25 21:36:24.514: E/AndroidRuntime(23206): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3345)
06-25 21:36:24.514: E/AndroidRuntime(23206): at android.app.ActivityThread.access$1100(ActivityThread.java:149)
06-25 21:36:24.514: E/AndroidRuntime(23206): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1348)
06-25 21:36:24.514: E/AndroidRuntime(23206): at android.os.Handler.dispatchMessage(Handler.java:99)
06-25 21:36:24.514: E/AndroidRuntime(23206): at android.os.Looper.loop(Looper.java:153)
06-25 21:36:24.514: E/AndroidRuntime(23206): at android.app.ActivityThread.main(ActivityThread.java:5086)
06-25 21:36:24.514: E/AndroidRuntime(23206): at java.lang.reflect.Method.invokeNative(Native Method)
06-25 21:36:24.514: E/AndroidRuntime(23206): at java.lang.reflect.Method.invoke(Method.java:511)
06-25 21:36:24.514: E/AndroidRuntime(23206): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
06-25 21:36:24.514: E/AndroidRuntime(23206): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
06-25 21:36:24.514: E/AndroidRuntime(23206): at dalvik.system.NativeStart.main(Native Method)
06-25 21:36:24.514: E/AndroidRuntime(23206): Caused by: java.lang.IllegalStateException: Couldn't read row 2, col 1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
06-25 21:36:24.514: E/AndroidRuntime(23206): at android.database.CursorWindow.nativeGetString(Native Method)
06-25 21:36:24.514: E/AndroidRuntime(23206): at android.database.CursorWindow.getString(CursorWindow.java:434)
06-25 21:36:24.514: E/AndroidRuntime(23206): at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)
06-25 21:36:24.514: E/AndroidRuntime(23206): at com.example.Assignment.MainActivity.checkEvents(MainActivity.java:367)
06-25 21:36:24.514: E/AndroidRuntime(23206): at com.example.Assignment.MainActivity.retrieveVid(MainActivity.java:374)
06-25 21:36:24.514: E/AndroidRuntime(23206): at com.example.Assignment.MainActivity.onActivityResult(MainActivity.java:321)
06-25 21:36:24.514: E/AndroidRuntime(23206): at android.app.Activity.dispatchActivityResult(Activity.java:5204)
06-25 21:36:24.514: E/AndroidRuntime(23206): at android.app.ActivityThread.deliverResults(ActivityThread.java:3298)
06-25 21:36:24.514: E/AndroidRuntime(23206): ... 11 more
Column indexing starts at 0. Your table has only 1 column. You don't specify a projection so all columns are returned in the cursor. Attempting to retrieve the value at column index 1 causes the exception.
To fix it, change getString(1) to getString(0).
First off, you try to read the second row of your cursor without checking if it is there. Also, like #laalto said, the columns on the cursor are zero-based, so with ´getString(1)´ you won't get anything, because the table has only one column.
I'd recommend you to get the String like this, this will be save, even if you add further rows to your Table:
if(cursor.moveToPosition(2)){
a = cursor.getString(cursor.getColumnIndex(sql.COLUMN_VID));
// add a constant (COLUMN_VID) to your sql class which defines the row name and also use this constant in your table creation
}
I am using SQlite database to store data.. but when I try to sum the columns using query I am getting error Column doesn't exists like below:
select _id, column1, sum(column2),sum(column3) from table
At the same time when I write without sum I am able to see the result in application as below.
select _id, column1, column2,column3 from table
Column2 and Column3 are Real data type columns.
I have no clue about this behaviour, why it is behaving this way.
Code to retrieve the columns from cursor.
summaryviewholder.Total.setText(String.valueOf(getsummary.getInt(getsummary.getColumnIndexOrThrow(st.column2))));
Logcat:
E/AndroidRuntime(8187): FATAL EXCEPTION: main
06-25 15:53:24.011: E/AndroidRuntime(8187): Process: com.example.portfoliomanager, PID: 8187
06-25 15:53:24.011: E/AndroidRuntime(8187): java.lang.IllegalArgumentException: column 'Buy_Qua' does not exist
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:303)
06-25 15:53:24.011: E/AndroidRuntime(8187): at com.example.StockDirector.stockmanager$popsummarystock.bindView(stockmanager.java:518)
06-25 15:53:24.011: E/AndroidRuntime(8187): at com.example.StockDirector.stockmanager$popsummarystock.newView(stockmanager.java:539)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.widget.CursorAdapter.getView(CursorAdapter.java:250)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.widget.AbsListView.obtainView(AbsListView.java:2720)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.widget.ListView.measureHeightOfChildren(ListView.java:1274)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.widget.ListView.onMeasure(ListView.java:1186)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.View.measure(View.java:17387)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.widget.RelativeLayout.measureChild(RelativeLayout.java:689)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:473)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.View.measure(View.java:17387)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5352)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.View.measure(View.java:17387)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5352)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.View.measure(View.java:17387)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5352)
06-25 15:53:24.011: E/AndroidRuntime(8187): at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:391)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.View.measure(View.java:17387)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5352)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
06-25 15:53:24.011: E/AndroidRuntime(8187): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2533)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.View.measure(View.java:17387)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2214)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1351)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1550)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1235)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6476)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.Choreographer.doCallbacks(Choreographer.java:603)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.Choreographer.doFrame(Choreographer.java:573)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.os.Handler.handleCallback(Handler.java:733)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.os.Handler.dispatchMessage(Handler.java:95)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.os.Looper.loop(Looper.java:157)
06-25 15:53:24.011: E/AndroidRuntime(8187): at android.app.ActivityThread.main(ActivityThread.java:5356)
06-25 15:53:24.011: E/AndroidRuntime(8187): at java.lang.reflect.Method.invokeNative(Native Method)
06-25 15:53:24.011: E/AndroidRuntime(8187): at java.lang.reflect.Method.invoke(Method.java:515)
06-25 15:53:24.011: E/AndroidRuntime(8187): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
06-25 15:53:24.011: E/AndroidRuntime(8187): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
06-25 15:53:24.011: E/AndroidRuntime(8187): at dalvik.system.NativeStart.main(Native Method)
06-25 15:53:25.486: I/Process(8187): Sending signal. PID: 8187 SIG: 9
You have to name your rows you summarize.
Other notes:
If you use sum (or aggregation function in general), you can't select other rows that are not aggregated, or else you won't get a proper result.
Also, use Float for getting the value from the database, as you use the Real datatype (floating point number) in sqlite.
So instead of this:
select _id, column1, sum(column2),sum(column3) from table
You have to do something like this:
select column1, sum(column2) AS sum1, sum(column3) AS sum2 from table group by column1;
And to the values:
summaryviewholder.Total.setText(String.valueOf(getsummary.getFloat(getsummary.getColumnIndexOrThrow("sum1"))));
When you write SELECT sum(Column2), then the name of the output column is sum(Column2).
You should either read the column values by their index (which is dangerous when the query ever changes), or give the output column another name:
SELECT sum(Column2) AS Column2Sum ...
I am writing a sample program in which i am using Youtube API, and it works fine, but I noticed that application crashes every time I try to play a video with enabled ads.
Log:
FATAL EXCEPTION: main
java.lang.IllegalStateException: android.os.DeadObjectException
at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.a(SourceFile:516)
at com.google.android.apps.youtube.api.jar.a.a.a(SourceFile:485)
at com.google.android.youtube.player.internal.h.onTransact(SourceFile:413)
at android.os.Binder.transact(Binder.java:326)
at com.google.android.youtube.player.internal.d$a$a.a(Unknown Source)
at com.google.android.youtube.player.internal.s.a(Unknown Source)
at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
at com.google.android.youtube.player.YouTubePlayerView$1.a(Unknown Source)
at com.google.android.youtube.player.internal.r.g(Unknown Source)
at com.google.android.youtube.player.internal.r$c.a(Unknown Source)
at com.google.android.youtube.player.internal.r$b.a(Unknown Source)
at com.google.android.youtube.player.internal.r$a.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1036)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:803)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.os.DeadObjectException
at android.os.BinderProxy.transact(Native Method)
at com.google.android.apps.youtube.api.b.a.aq.a(SourceFile:706)
at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.a(SourceFile:513)
few Questions:
How can i resolve this issue ?
Is it possible to block the ad on Youtube Player API ?
I am trying to integrate the Youtube API into my project. To do so,
I have copied the the necessary jar files from the sdk folder to my project
Added it to my project build path.
I have also obtained a key from google, and added it to the Developer.java file, and it is used at the time of calling the intialize() function.
The program shows no error at build time. However, when it shows the follwing log when I try to initialize. Please help:
06-25 18:26:15.813: E/AndroidRuntime(6197): FATAL EXCEPTION: main
06-25 18:26:15.813: E/AndroidRuntime(6197): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.deltapath.frSIP/hk.d100.VideoPlayer}: java.lang.IllegalArgumentException: callingAppVersion cannot be null or empty
06-25 18:26:15.813: E/AndroidRuntime(6197): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
06-25 18:26:15.813: E/AndroidRuntime(6197): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-25 18:26:15.813: E/AndroidRuntime(6197): at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-25 18:26:15.813: E/AndroidRuntime(6197): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-25 18:26:15.813: E/AndroidRuntime(6197): at android.os.Handler.dispatchMessage(Handler.java:99)
06-25 18:26:15.813: E/AndroidRuntime(6197): at android.os.Looper.loop(Looper.java:137)
06-25 18:26:15.813: E/AndroidRuntime(6197): at android.app.ActivityThread.main(ActivityThread.java:5041)
06-25 18:26:15.813: E/AndroidRuntime(6197): at java.lang.reflect.Method.invokeNative(Native Method)
06-25 18:26:15.813: E/AndroidRuntime(6197): at java.lang.reflect.Method.invoke(Method.java:511)
06-25 18:26:15.813: E/AndroidRuntime(6197): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-25 18:26:15.813: E/AndroidRuntime(6197): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-25 18:26:15.813: E/AndroidRuntime(6197): at dalvik.system.NativeStart.main(Native Method)
06-25 18:26:15.813: E/AndroidRuntime(6197): Caused by: java.lang.IllegalArgumentException: callingAppVersion cannot be null or empty
06-25 18:26:15.813: E/AndroidRuntime(6197): at com.google.android.youtube.player.internal.ac.a(Unknown Source)
06-25 18:26:15.813: E/AndroidRuntime(6197): at com.google.android.youtube.player.internal.o.<init>(Unknown Source)
06-25 18:26:15.813: E/AndroidRuntime(6197): at com.google.android.youtube.player.internal.ad.a(Unknown Source)
06-25 18:26:15.813: E/AndroidRuntime(6197): at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source)
06-25 18:26:15.813: E/AndroidRuntime(6197): at com.google.android.youtube.player.YouTubeBaseActivity$a.a(Unknown Source)
06-25 18:26:15.813: E/AndroidRuntime(6197): at com.google.android.youtube.player.YouTubePlayerView.initialize(Unknown Source)
06-25 18:26:15.813: E/AndroidRuntime(6197): at hk.d100.VideoPlayer.onCreate(VideoPlayer.java:42)
06-25 18:26:15.813: E/AndroidRuntime(6197): at android.app.Activity.performCreate(Activity.java:5104)
06-25 18:26:15.813: E/AndroidRuntime(6197): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
06-25 18:26:15.813: E/AndroidRuntime(6197): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
06-25 18:26:15.813: E/AndroidRuntime(6197): ... 11 more
If possible, please include your use of the YouTube API (rather than only the stack trace) so others can help you out.
I try to use OSMdroid in one of my applictions, but i got this:
running on hardware device Android 4.0.3 (CM9)
log from logcat:
06-25 16:56:07.389: E/AndroidRuntime(17760): java.lang.RuntimeException: Unable to start activity ComponentInfo{app.OSMMapViewActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class org.osmdroid.views.MapView
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2079)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.app.ActivityThread.access$600(ActivityThread.java:132)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1157)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.os.Handler.dispatchMessage(Handler.java:99)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.os.Looper.loop(Looper.java:137)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.app.ActivityThread.main(ActivityThread.java:4575)
06-25 16:56:07.389: E/AndroidRuntime(17760): at java.lang.reflect.Method.invokeNative(Native Method)
06-25 16:56:07.389: E/AndroidRuntime(17760): at java.lang.reflect.Method.invoke(Method.java:511)
06-25 16:56:07.389: E/AndroidRuntime(17760): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
06-25 16:56:07.389: E/AndroidRuntime(17760): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
06-25 16:56:07.389: E/AndroidRuntime(17760): at dalvik.system.NativeStart.main(Native Method)
06-25 16:56:07.389: E/AndroidRuntime(17760): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class org.osmdroid.views.MapView
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-25 16:56:07.389: E/AndroidRuntime(17760): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.app.Activity.setContentView(Activity.java:1835)
06-25 16:56:07.389: E/AndroidRuntime(17760): at app.OSMMapViewActivity.onCreate(OSMMapViewActivity.java:16)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.app.Activity.performCreate(Activity.java:4465)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2033)
06-25 16:56:07.389: E/AndroidRuntime(17760): ... 11 more
06-25 16:56:07.389: E/AndroidRuntime(17760): Caused by: java.lang.ClassNotFoundException: org.osmdroid.views.MapView
06-25 16:56:07.389: E/AndroidRuntime(17760): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-25 16:56:07.389: E/AndroidRuntime(17760): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-25 16:56:07.389: E/AndroidRuntime(17760): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
06-25 16:56:07.389: E/AndroidRuntime(17760): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
06-25 16:56:07.389: E/AndroidRuntime(17760): ... 21 more
i hope this will help you more.
mapscreen.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<org.osmdroid.views.MapView
android:id="#+id/mapview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:clickable="true" />
</LinearLayout>
this is my activity:
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapController;
import org.osmdroid.views.MapView;
import android.app.Activity;
import android.os.Bundle;
public class OSMMapViewActivity extends Activity{
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mapscreen);
MapView mMapView = (MapView) findViewById(R.id.mapview);
mMapView.setTileSource(TileSourceFactory.MAPNIK);
mMapView.setBuiltInZoomControls(true);
MapController mMapController = mMapView.getController();
mMapController.setZoom(13);
GeoPoint gPt = new GeoPoint(51500000, -150000);
//Centre map near to Hyde Park Corner, London
mMapController.setCenter(gPt);
}
}
i'm using OSMDroid 3.0.8 and slf4j-1.5.8 and eclipse.
EDIT:
I commented out the setContentView() and the other code. I think the problem is something eith the layout files...
EDIT1:
The Problem is solved... :)
copy osmdroid and the other jars from libs/osmdroid
to libs/ ^_^
Thanks for help anyway!!!!
Thx for helping
Have you added the proper permissions in your Android Manifest file?
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Missing either of these, although ACCESS_FINE_LOCATION could be replaced by ACCESS_COARSE_LOCATION, will usually cause any type of MapView to fail.
The problem is that eclipse need a restart, to load external libraries correct.
Thanks for all your help!!!
I had the same problem.
I solved it by:
cd into the libs folder of your project.
ls .
Notice, there is only one of the required libs. The osmdroid-android-4.0.jar is absent.
Copy it from where you downloaded and saved it from, into this folder.
Run the application now. I should work.
Note: I had already added it to the project path by selecting the project->properties->Java Built path->Libraries.
The required libs are:
slf4j-android-1.5.8.jar
osmdroid-android-4.0.jar