I am confused about the permissions section for IBM's MobileFirst GMS Push notifications found here. (Section 5)
https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/notifications/push-notification-native-android-applications/
I have added all of these permissions verbatim, but im getting an error saying i havn't added manifest permissions. Do i need to modify the package names in these permissions?
Is this activity built in?
<activity
android:name="com.worklight.androidnativepush.AndroidNativePush"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:launchMode="singleTask">
Here is the error logcat
07-25 23:24:48.285 17146-17146/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.companyname.hitch.mobilefirsttestapp, PID: 17146
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.companyname.hitch.mobilefirsttestapp/com.companyname.hitch.mobilefirsttestapp.push.PushActivity}: java.lang.RuntimeException: Your manifest is not allowed to work with push. Android Manifest Error: Missing permission in manifest: com.companyname.hitch.mobilefirsttestapp.permission.C2D_MESSAGE
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Your manifest is not allowed to work with push. Android Manifest Error: Missing permission in manifest: com.companyname.hitch.mobilefirsttestapp.permission.C2D_MESSAGE
at com.worklight.wlclient.api.WLPush.<init>(WLPush.java:180)
at com.worklight.wlclient.api.WLClient.getPush(WLClient.java:957)
at com.companyname.hitch.mobilefirsttestapp.push.PushActivity.onCreate(PushActivity.java:19)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
When creating a MobileFirst-based Hybrid app with the Android environment, MobileFirst will be creating it based on a template with a set of predefined permissions and activities.
In a native application, you are the one creating it. MobileFirst only supplies you with the SDK and a set of integration instructions.
The activity that you mentioned in the question (taken from the tutorial page) is the activity of the sample application included in the tutorial. In your own app's AndroidManifest.xml you will see your app's name instead of "androidnativepush" (or rather need to create it).
Make sure not to use "androidnativepush" anywhere unless that is your app name.
Related
I tried following the intstructions for adding a facebook login for my app.
https://developers.facebook.com/docs/facebook-login/android/v2.2
I did the step for Add the Login Button.
It displays properly on my screen however I get the following error when I click it:
Process: com.parse.starter, PID: 3073
Log in attempt failed: LoginActivity could not be started
at com.facebook.login.LoginManager.startLogin(LoginManager.java:382)
at com.facebook.login.LoginManager.logInWithReadPermissions(LoginManager.java:262)
at com.facebook.login.widget.LoginButton$LoginClickListener.onClick(LoginButton.java:693)
at com.facebook.FacebookButtonBase$1.onClick(FacebookButtonBase.java:310)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Do I need to handle user clicks in my code. Somehow I thought this was inbuilt in the button. Thanks for the help.
For Facebook SDK 4+, you need the following in your manifest:
<activity android:name="com.facebook.FacebookActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name" />
I refactored my package name and put my CuteMainActivityin the package org.azurespot.cutemain.CuteMainActivity. Plus rearranged all my other classes. So now I get a red error on the .CuteMainActivity part in my Manifest, where the activity should launch.
I also changed the top package name of my Manifest to the new one: org.azurespot, and also changed my applicationID in my build.gradle file to the new package name org.azurespot too. Then I rebuilt, cleaned, and even tried invalidate and restart to my project but nothing is getting rid of this red error. I also tried to assign the new package/activity name to launch in my run configurations, and got this error:
Launching application: org.azurespot/org.azurespot.cutemain.CuteMainActivity.
DEVICE SHELL COMMAND: am start -n "org.azurespot/org.azurespot.cutemain.CuteMainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=org.azurespot/.cutemain.CuteMainActivity }
Error type 3
Error: Activity class {org.azurespot/org.azurespot.cutemain.CuteMainActivity} does not exist
One strange thing, is that my package name has the word (androidTest) beside it. Would that make things not work? Usually studio creates a regular package name and a package_name (androidTest), but in the refactoring, I only see this (androidTest) one.
I have been researching this problem for a while, but nothing seems to work. Any suggestions? Thank you.
Manifest.java
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.azurespot" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".CuteMainActivity" //This has a red error
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
LogCat after changed Manifest name to ".cutemain.CuteMainActivity"
1480-1480/org.azurespot E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: org.azurespot, PID: 1480
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.azurespot/org.azurespot.cutemain.CuteMainActivity}: java.lang.ClassNotFoundException: Didn't find class "org.azurespot.cutemain.CuteMainActivity" on path: DexPathList[[zip file "/data/app/org.azurespot-2.apk"],nativeLibraryDirectories=[/data/app-lib/org.azurespot-2, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.azurespot.cutemain.CuteMainActivity" on path: DexPathList[[zip file "/data/app/org.azurespot-2.apk"],nativeLibraryDirectories=[/data/app-lib/org.azurespot-2, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2101)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
You should change it to one of the followings:
android:name="org.azurespot.cutemain.CuteMainActivity"
or
android:name=".cutemain.CuteMainActivity"
Ah... the package name with (androidTest) was indeed the culprit. All of the above answers should have fixed things, but the final problem was that when I refactored (I have no idea how it happened), all of my new package names got put into my androidTest directory in the src folder, and nothing was in my main of my src folder. So when my app went looking for the main activity, it could not be found. The fix to this was to put the whole java folder back into the main folder (as it was empty for some reason), then restart the app and everything worked again. It was not necessary to delete the androidTest folder, and it seems fine that it's empty.
I have been editing the FriendPikcerSample provided by Facebook SDK for Android (latest version).
A couple of hours ago I successfully inserted a listview instead of a textview, so that when I select a name in the ListView, I can fetch more details of the user in the further activity
But Now, after restarting my PC, the app is behaving weird. When I launch it and click on "Pick Friends", it should be showing the list of friends who are using the app. Instead, now the app crashes and logcat shows this error.
12-30 07:35:15.820 2238-2238/com.facebook.samples.friendpicker E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.facebook.samples.friendpicker, PID: 2238
com.facebook.FacebookGraphObjectException: Factory can't proxy method: public abstract void com.facebook.model.GraphUser.setBirthday()
at com.facebook.model.GraphObject$Factory.verifyCanProxyClass(GraphObject.java:290)
at com.facebook.model.GraphObject$Factory.createGraphObjectProxy(GraphObject.java:216)
at com.facebook.model.GraphObject$Factory.coerceValueToExpectedType(GraphObject.java:340)
at com.facebook.model.GraphObject$Factory$GraphObjectListImpl.get(GraphObject.java:772)
at java.util.AbstractList$SimpleListIterator.next(AbstractList.java:55)
at java.util.AbstractCollection.toArrayList(AbstractCollection.java:349)
at java.util.AbstractCollection.toArray(AbstractCollection.java:339)
at java.util.ArrayList.addAll(ArrayList.java:188)
at com.facebook.widget.SimpleGraphObjectCursor.addGraphObjects(SimpleGraphObjectCursor.java:46)
at com.facebook.widget.GraphObjectPagingLoader.addResults(GraphObjectPagingLoader.java:203)
at com.facebook.widget.GraphObjectPagingLoader.requestCompleted(GraphObjectPagingLoader.java:186)
at com.facebook.widget.GraphObjectPagingLoader.access$000(GraphObjectPagingLoader.java:27)
at com.facebook.widget.GraphObjectPagingLoader$2.onCompleted(GraphObjectPagingLoader.java:134)
at com.facebook.Request$4.run(Request.java:1666)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Can anyone help me understand what's gone wrong?
I'm getting a crash always when I install or uninstall an app that use Sync Service, like Facebook, whatsup, etc.
"Unfortunately, Exchange Services has stopped."
I don't know why, but it just happens for some devices, in my case all of then are Android 4.4.2.
First I thought it's my app's fault, but it doesn't make sense once I uninstall my app and the problem continues happening for others apps.
Do you know something about it?
Thank you.
02-07 14:31:49.864 3015-3015/? E/ActivityThread﹕ Failed to find provider info for com.google.android.email.provider
02-07 14:31:49.864 3015-3015/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.google.android.exchange, PID: 3015
java.lang.RuntimeException: Unable to create application com.android.exchange.Exchange: java.lang.IllegalArgumentException: Unknown URI content://com.google.android.email.provider
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4347)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: Unknown URI content://com.google.android.email.provider
at android.content.ContentResolver.call(ContentResolver.java:1352)
at com.android.exchange.Exchange.onCreate(Exchange.java:34)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
I found what was happening!
The problem occurs by device when there are sync accounts registered, but the Exchange Service cannot find any application to answer the URI, in my case it was "content://com.google.android.email.provider", to fix it I checked my disable applications and there was it, my default email application was disable. I just enable it again and the problem never occurs again.
Go to Settings > Apps > ALL> Exchange Services > Clear Cache and try opening it. When it opens, check once.
I had that problem. now I’m using a good app called Mailwise. it’s a free email app, very convenient for businesses, you can easily set up multiple email accounts, and it works great with Exchange.
https://play.google.com/store/apps/details?id=com.syntomo.email&hl=en
I just added GMS to my app to use the LocationClient and now my app is crashing upon startup. Looks like my main activity can no longer find my service which is where the location logic is handled.
I added the below line to my gradle dependencies in order to pull in gms.
compile 'com.google.android.gms:play-services:4.0.30'
This is the error I am getting.
28 22:10:39.761 2885-2885/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.nathan.allgood, PID: 2885
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/myname/appname/services/ActivityService;
Also have this in my manifest:
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Any Ideas?
Thanks,
Nathan
EDIT: Added LogCat and Method where error happens
/**
* Bind this Activity to MyService
*/
private void doBindService() {
getActivity().bindService(new Intent(getActivity(), ActivityService.class), mConnection, Context.BIND_AUTO_CREATE);
mIsBound = true;
}
11-28 22:53:59.502 2278-2278/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.myname.appname, PID: 2278
java.lang.NoClassDefFoundError: com.myname.appname.services.ActivityService
at com.myname.appname.Activity1$OneFragment.automaticBind(Activity1.java:119)
at com.myname.appname.Activity1$OneFragment.onResume(Activity1.java:105)
at android.app.Fragment.performResume(Fragment.java:1743)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:924)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1044)
at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:1863)
at android.app.Activity.performResume(Activity.java:5332)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2779)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2818)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.access$700(ActivityThread.java:145)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1407)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5062)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
11-28 23:33:12.336 6335-6335/com.myname.appname E/dalvikvm﹕ Could not find class 'com.myname.appname.services.ActivityService', referenced from method com.myname.appname.Activity1$OneFragment.doBindService
11-28 23:33:12.386 6335-6335/com.myname.appname E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.myname.appname, PID: 6335
java.lang.NoClassDefFoundError: com.myname.appname.services.ActivityService
at com.myname.appname.Activity1$OneFragment.automaticBind(Activity1.java:119)
at com.myname.appname.Activity1$OneFragment.onResume(Activity1.java:105)
at android.app.Fragment.performResume(Fragment.java:1743)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:924)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1044)
at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:1863)
at android.app.Activity.performResume(Activity.java:5332)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2779)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2818)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.access$700(ActivityThread.java:145)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1407)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5062)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Edit 2:
I should also mention I am using Android Studio
SOLUTION!!!
Edit 3:
Following some advice from another stackoverflow post I did a
gradlew clean and then gradlew build which seems to have fixed the problem!
Because you have not post your code, look for "Caused by" in your logcat. Tell me why you use AsyncTask to get your Location?