Actually i'm trying to implement zebra EMDK library to my yet existing project.
I've followed step by step the following guide and in a new project all worked perfectly but when i've tryed to use the library in my project i've got the following error:
2019-03-13 15:24:55.720 4671-4678/it.gabtamagnini.realco E/art: Failed sending reply to debugger: Broken pipe
2019-03-13 15:25:01.239 4671-4671/it.gabtamagnini.realco E/AndroidRuntime: FATAL EXCEPTION: main
Process: it.gabtamagnini.realco, PID: 4671
java.lang.RuntimeException: Unable to start activity ComponentInfo{it.gabtamagnini.realco/it.gabtamagnini.realco.InventarioActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.contentEquals(java.lang.CharSequence)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2666)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.contentEquals(java.lang.CharSequence)' on a null object reference
at it.gabtamagnini.realco.InventarioActivity.handleDecodeData(InventarioActivity.java:1160)
at it.gabtamagnini.realco.InventarioActivity.onCreate(InventarioActivity.java:129)
at android.app.Activity.performCreate(Activity.java:6723)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2619)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Code where i get the null pointer:
private void handleDecodeData(Intent i) {
//Check the intent action is for us
if (i.getAction().contentEquals("com.symbol.emdksample.RECVR")) {
//Get the source of the data
String source = i.getStringExtra("com.motorolasolutions.emdk.datawedge.source");
//Check if the data has come from the Barcode scanner
if (source.equalsIgnoreCase("scanner")) {
//Get the data from the intent
String data = i.getStringExtra("com.motorolasolutions.emdk.datawedge.data_string");
//Check that we have received data
if(data != null && data.length() > 0)
{
Toast.makeText(InventarioActivity.this,data,Toast.LENGTH_LONG).show();
}
}
}
}
that tutorial is quite old - Data Capture Profiles were recently deprecated. If you are trying this on a newer device then I suspect the com.motorolasolutions... Intents have been removed as the string extra has been 'com.symbol.datawedge.data_string for quite some time. I suggest reading https://developer.zebra.com/community/home/blog/2018/06/03/moving-from-the-emdk-data-capture-profile-to-datawedge which explains what has happened to the Data Capture profile but if you are looking for a known working sample then http://www.darryncampbell.co.uk/2017/12/13/tutorial-scan-with-datawedge-intent-output-on-zebra-devices/ should be a good starting point.
For clarity, I work for Zebra
Related
I am trying to Create side bar navigation in android but there is one problem I am facing.I went through so many post on stackoverflow but it didn't solved my problem
I am following the tutorial exactly mentioned here
But when I a running my app I am getting error
Process: com.example.deepak.myapplication, PID: 26704
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.deepak.myapplication/com.example.deepak.myapplication.Naviagtion}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2721)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2782)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1521)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6228)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference
at com.example.deepak.myapplication.Naviagtion.onCreate(Naviagtion.java:29)
at android.app.Activity.performCreate(Activity.java:6871)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2674)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2782)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1521)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6228)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
I am using styles as mentioned
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
Also I am Extending AppCompatActivity
So please help me and let me know where I am going wrong
you have not set ActionBar, put this line above
setSupportActionBar(toolbar); // <--- put this
ActionBar.setDisplayHomeAsUpEnabled(true)
When I run my app on the emulator with version 27 & 28 APIs, everything works for me. However, as soon as I try to go to a lower level API, I get error messages regarding the setContentView() method in my custom Activity.java class.
Here is the stack trace:
2018-12-06 15:37:59.166 9426-9426/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mplexvr.ribbonracker, PID: 9426
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mplexvr.ribbonracker/com.mplexvr.ribbonracker.RibbonRackerActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f0b0000
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f0b0000
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:190)
at android.content.res.Resources.getDrawable(Resources.java:766)
at android.content.Context.getDrawable(Context.java:525)
at com.android.internal.widget.ToolbarWidgetWrapper.setIcon(ToolbarWidgetWrapper.java:322)
at com.android.internal.widget.ActionBarOverlayLayout.setIcon(ActionBarOverlayLayout.java:737)
at com.android.internal.policy.PhoneWindow.setDefaultIcon(PhoneWindow.java:1737)
at android.app.Activity.initWindowDecorActionBar(Activity.java:2400)
at android.app.Activity.setContentView(Activity.java:2415)
at com.mplexvr.ribbonracker.RibbonRackerActivity.onCreate(RibbonRackerActivity.java:46)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
I tried to run this app on both a phone and emulator with a version 24 api, and nothing works. My activity_main.xml that the onCreate() method tries to call just contains two fragments that are modified in the onCreate() method. Here is a snippet of code from that:
/* This code runs perfectly fine on the version 28 and 27 api on the emulator*/
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
images = new ArrayList<>();
imageNames = new ArrayList<>();
setContentView(R.layout.activity_main);
Log.v(TAG, "I got in onCreate");
//Create the fragment for the ranking and add it to the current view
// Get references to the TitleFragment and to the QuotesFragment containers
mRibbonFrameLayout = findViewById(R.id.ribbon_fragment_container);
mChecklistFrameLayout = findViewById(R.id.checkbox_fragment_container);
...
}
I tried looking this problem up, but nothing I found has solved this problem - at least publicly.
UPDATE Solved within 5 minutes when I figured out that a folder had a version of 26, which would limit on using that version.
I am trying to build an android application with chromecast.
I use MediaRouter to select chromecast devices but there are some error messages when I select and unselect many times.
For example, I select chromecast device, load media, play media then unselect. When I try to load the media at 4th or 5th, the error message show up.
There is the error message.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.kevin.chromecasttest, PID: 1066
java.lang.RuntimeException: Unable to create service com.google.android.gms.cast.framework.media.MediaNotificationService: java.lang.NullPointerException: Attempt to invoke interface method 'android.os.IBinder ani.asBinder()' on a null object reference
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2909)
at android.app.ActivityThread.access$2000(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5444)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:746)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'android.os.IBinder ani.asBinder()' on a null object reference
at anl.a(:com.google.android.gms.DynamiteModulesC:47)
at com.google.android.gms.cast.framework.internal.CastDynamiteModuleImpl.newMediaNotificationServiceImpl(:com.google.android.gms.DynamiteModulesC:72)
at aap.onTransact(:com.google.android.gms.DynamiteModulesC:121)
at android.os.Binder.transact(Binder.java:387)
at com.google.android.gms.internal.zzoj$zza$zza.zza(Unknown Source)
at com.google.android.gms.internal.zzog.zza(Unknown Source)
at com.google.android.gms.cast.framework.media.MediaNotificationService.onCreate(Unknown Source)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2899)
at android.app.ActivityThread.access$2000(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5444)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:746)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
Thanks in advance for your answers!
Suddently, during regular usage of my Nexus 5, the Google Play Store started crashing every time I try to open it.
So, I tried to get the log of the error, here it is:
11664-11664/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.android.vending, PID: 11664
java.lang.RuntimeException: Unable to create application com.google.android.finsky.FinskyApp: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.AppOpsManager.checkPackage(int, java.lang.String)' on a null object reference
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:334)
at android.app.ActivityThread.handleBindApplication(<Xposed>)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.AppOpsManager.checkPackage(int, java.lang.String)' on a null object reference
at android.os.Parcel.readException(Parcel.java:1605)
at android.os.Parcel.readException(Parcel.java:1552)
at android.content.pm.IPackageInstaller$Stub$Proxy.getMySessions(IPackageInstaller.java:385)
at android.content.pm.PackageInstaller.getMySessions(PackageInstaller.java:415)
at com.google.android.finsky.installer.PackageInstallerImpl.<init>(PackageInstallerImpl.java:71)
at com.google.android.finsky.installer.PackageInstallerFactory.init(PackageInstallerFactory.java:23)
at com.google.android.finsky.FinskyApp.onCreate(FinskyApp.java:387)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)
at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:334)
at android.app.ActivityThread.handleBindApplication(<Xposed>)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102) `
I tried to look for this error online, but couldn't find anything. I assume it's related to some system app that has one of her permissions unapproved (I don't know which could be the one), or maybe related to my Xposed Framework installation.
What could it be?
Thank you for your help.
its not any other problem did you see Attempt to invoke virtual method 'void android.app.AppOpsManager.checkPackage(int, java.lang.String)' on a null object reference. you have calling some null object reference.
I am adding Facebook Share functionality to my app. I am using SDK v4.5. In the SDK documentation, we are told to add the following meta-data tag to AndroidManifest:
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
The problem is, I get my app id from server by making an http request. In the older version of Facebook SDK, i could initialize the SDK with the app id from java code, so it would not be a problem:
mFacebook = new Facebook(FACEBOOK_APP_ID);
But now with the new SDK, if I do not put that meta-data tag, I get the following error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.yrazlik.facebooklogindemo, PID: 6450
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.yrazlik.facebooklogindemo/com.yrazlik.facebooklogindemo.MainActivity}:
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:772)
at com.facebook.internal.Utility.getDialogFeatureConfig(Utility.java:882)
at com.facebook.internal.DialogPresenter.getVersionSpecForFeature(DialogPresenter.java:253)
at com.facebook.internal.DialogPresenter.getProtocolVersionForNativeDialog(DialogPresenter.java:239)
at com.facebook.internal.DialogPresenter.canPresentNativeDialogWithFeature(DialogPresenter.java:73)
at com.facebook.share.widget.ShareDialog.canShowNative(ShareDialog.java:131)
at com.facebook.share.widget.ShareDialog.access$300(ShareDialog.java:53)
at com.facebook.share.widget.ShareDialog$NativeHandler.canShow(ShareDialog.java:239)
at com.facebook.share.widget.ShareDialog$NativeHandler.canShow(ShareDialog.java:231)
at com.facebook.internal.FacebookDialogBase.createAppCallForMode(FacebookDialogBase.java:184)
at com.facebook.internal.FacebookDialogBase.showImpl(FacebookDialogBase.java:147)
at com.facebook.internal.FacebookDialogBase.show(FacebookDialogBase.java:142)
at com.yrazlik.facebooklogindemo.MainActivity.onCreate(MainActivity.java:136)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
So, is there anything I can do about that? Can i somehow set app id from java code instead of using meta-data tag?
Thanks.
I found a way to do this. There is clearly a method for setting the app id from code instead of using meta-data tag. I deleted the meta-data tag from the manifest, and used the following methods and now it works fine.
FacebookSdk.setApplicationId(AppConstants.FACEBOOK_APP_ID);
FacebookSdk.sdkInitialize(getApplicationContext());
You can make service call for facebook app id at the time of splash screen. and save it in sharedpreferences.
then initialize
FacebookSdk.setApplicationId(GET FACEBOOK APP ID FROM SHARED PREFERENCES);
Facebook.sdkInitialize(getApplicationContext());
But make sure you have to first get facebook app id from server and then only you can initialize. otherwise application will be force closed.