I have bug with amazon device messaging.
compile in gradle:
//compile in gradle
provided files('libs/amazon-device-messaging-1.0.1.jar')
I've been tried:
compile files('libs/amazon-device-messaging-1.0.1.jar')
manifest:
<permission android:name="com.bookmark.money.permission.RECEIVE_ADM_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.bookmark.money.permission.RECEIVE_ADM_MESSAGE" />
<uses-permission android:name="com.amazon.device.messaging.permission.RECEIVE" />
<application ...>
<amazon:enable-feature
android:name="com.amazon.device.messaging"
android:required="true" />
</application>
call ADM:
//call adm
ADM adm = new ADM(context); //error inline
in logcat:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.amazon.device.messaging.ADM
at com.zoostudio.moneylover.cloudMessage.CloudMessageHelper.getCloudMessageId(CloudMessageHelper.java:21)
at com.zoostudio.moneylover.cloudMessage.CloudMessageHelper.register(CloudMessageHelper.java:14)
at com.zoostudio.moneylover.MoneyApplication.createObjectSingleton(MoneyApplication.java:511)
at com.zoostudio.moneylover.MoneyApplication.onCreate(MoneyApplication.java:294)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1000)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4391)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
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:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)'
Please help me if you have any ideas!
*Update:
Levon from Amazon reply for me. ADM can run on physical device (of Amazon or not) but not work :(
same error:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/amazon/device/messaging/ADM;
I have had the same issue. Problem was in xml namespace in manifest.
It should be like in documentation:
xmlns:amazon="http://schemas.amazon.com/apk/res/android"
Related
What is the difference between the two Android permission below related to browser Bookmark History?
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/> -->
<uses-permission android:name="android.permission.READ_HISTORY_BOOKMARKS" />
My app works fine with the first one only, and crash with the second.
SDK version:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
Error Log when I use the second permission tag:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.SecurityException: Permission Denial: reading com.android.browser.provider.BrowserProvider2 uri content://browser/bookmarks from pid=5063, uid=10050 requires com.android.browser.permission.READ_HISTORY_BOOKMARKS, or grantUriPermission()
at android.os.Parcel.readException(Parcel.java:1431)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:385)
at android.content.ContentResolver.query(ContentResolver.java:414)
at android.content.ContentResolver.query(ContentResolver.java:357)
at course.labs.permissionslab.BookmarksActivity.loadBookmarks(BookmarksActivity.java:56)
at course.labs.permissionslab.BookmarksActivity.access$000(BookmarksActivity.java:14)
at course.labs.permissionslab.BookmarksActivity$1.onClick(BookmarksActivity.java:32)
at android.view.View.performClick(View.java:4240)
at android.view.View$PerformClick.run(View.java:17721)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Android version: 4.3.1
Thanks!
This release removes support for global bookmarks. The android.provider.Browser.getAllBookmarks() and android.provider.Browser.saveBookmark() methods are now removed. Likewise, the READ_HISTORY_BOOKMARKS and WRITE_HISTORY_BOOKMARKS permissions are removed. If your app targets Android 6.0 (API level 23) or higher, don't access bookmarks from the global provider or use the bookmark permissions. Instead, your app should store bookmarks data internally.
https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-bookmark-browser
I've set my map following the instructions in this link. And set the WRITE_EXTERNAL_STORAGE permission in accordance with the recomended by the Official Android Documentation, that is request this permission only for API level 18 and lower. So, I have this manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp" >
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-library android:name="com.google.android.maps"/>
<activity
android:name=".activities.HomeActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/map_api_key"/>
</application>
</manifest>
But I am facing this error:
Caused by: java.lang.SecurityException: The Maps API requires the additional following
permissions to be set in the AndroidManifest.xml to ensure a correct behavior:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
But, as it is showed in my manifest, I have this permission. One detail is if I put only the WRITE_EXTERNAL_STORAGE permission, without specifying the maxSdkVersion value, the app works properly.
Is this an Android bug or am I forgetting something in my app configuration?
UPDATE 1
This is the logcat:
FATAL EXCEPTION: main
Process: com.example.map, PID: 15534
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.map/com.example.map.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
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: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: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
at android.app.Activity.setContentView(Activity.java:1929)
at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:216)
at android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.java:110)
at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:76)
at com.example.map.MainActivity.onCreate(MainActivity.java:16)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
... 11 more
Caused by: java.lang.SecurityException: The Maps API requires the additional following permissions to be set in the AndroidManifest.xml to ensure a correct behavior:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
at maps.e.ci.a(Unknown Source)
at maps.e.ay.a(Unknown Source)
at maps.e.ay.a(Unknown Source)
at maps.e.al.a(Unknown Source)
at maps.e.bh.a(Unknown Source)
at maps.e.bg.a(Unknown Source)
at etu.onTransact(SourceFile:107)
at android.os.Binder.transact(Binder.java:361)
at com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$a.onCreateView(Unknown Source)
at com.google.android.gms.dynamic.a$4.b(Unknown Source)
at com.google.android.gms.dynamic.a.a(Unknown Source)
at com.google.android.gms.dynamic.a.onCreateView(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1093)
at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1195)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
UPDATE 2
My layout:
<fragment
android:id="#+id/map"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
class="com.google.android.gms.maps.SupportMapFragment" />
UPDATE 3
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
If you check the link you've provided to the <uses-permission> documentation, you'll see that it states that:
it's no longer necessary for your app to request the WRITE_EXTERNAL_STORAGE permission when your app wants to write to its own application-specific directories on external storage (the directories provided by getExternalFilesDir()).
It would appear that the Maps API needs write access to other directories. And if you check the Specify permissions section of the other link you gave, it still lists the WRITE_EXTERNAL_STORAGE permission as required, with no mention of exception for API Level 19.
After having checked many, many online resources with regard to the Maps API, Android API Level 19, and the restriction of the WRITE_EXTERNAL_STORAGE permission, I found no source or example that listed or referenced a working example using the Maps API with that permission restricted to API Level 18 and below. Again, I quote the link you've provided that says the permission is not needed in API Level 19 "when your app wants to write to its own application-specific directories on external storage". (I would point out that it merely says it is not necessary in that case, and in no way "recommends" that you set this restriction absolutely.) The Maps API needs write-permission to external storage directories that are not owned by your app. The fact that "without specifying the maxSdkVersion value, the app works properly" indicates that even in KitKat, Maps needs that permission. The error is telling you exactly that.
I did some research around the maxSdkVersion. And I found the following
From google
http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
Warning: Declaring this attribute is not recommended. First, there is no need to set the attribute as means of blocking deployment of your application onto new versions of the Android platform as they are released. By design, new versions of the platform are fully backward-compatible. Your application should work properly on new versions, provided it uses only standard APIs and follows development best practices. Second, note that in some cases, declaring the attribute can result in your application being removed from users' devices after a system update to a higher API Level. Most devices on which your application is likely to be installed will receive periodic system updates over the air, so you should consider their effect on your application before setting this attribute.
I have something like this in my current working google app
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
So if you really want, you can try put that maxSdkVersion in the note, unless its what google is documented in the above link.
Hope this help
The XML code provided in the link is for Android API 12 or later.
Since your minSDKVersion is 8. Use this:
<fragment
android:id="#+id/map"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
class="com.google.android.gms.maps.SupportMapFragment" />
Check here for more.
I am trying to test the tic-tac-toe in eclipse. It compiles and deploys to emulator device (AVD) but no matter what version of Android I use, the application deployed says: Application Stopped. Close it. Is there any specific setting I should follow?
Note: I already setup the Eclipse environment, add libraries, etc.
Thanks!
Here is the log error:
01-16 01:07:35.994: E/AndroidRuntime(883): FATAL EXCEPTION: main
01-16 01:07:35.994: E/AndroidRuntime(883): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.google.cast.samples.tictactoe/com.google.cast.samples.tictactoe.GameActivity}: java.lang.ClassNotFoundException: Didn't find class "com.google.cast.samples.tictactoe.GameActivity" on path: DexPathList[[zip file "/data/app/com.google.cast.samples.tictactoe-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.google.cast.samples.tictactoe-1, /system/lib]]
01-16 01:07:35.994: E/AndroidRuntime(883): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
01-16 01:07:35.994: E/AndroidRuntime(883): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
01-16 01:07:35.994: E/AndroidRuntime(883): at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-16 01:07:35.994: E/AndroidRuntime(883): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.cast.samples.tictactoe.GameActivity" on path: DexPathList[[zip file "/data/app/com.google.cast.samples.tictactoe-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.google.cast.samples.tictactoe-1, /system/lib]]
01-16 01:07:35.994: E/AndroidRuntime(883): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
Thanks Ali. Here is the manifest, but I see there is a match of class and activity.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.cast.samples.tictactoe"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-feature
android:name="android.hardware.wifi"
android:required="true" >
</uses-feature>
<application
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat" >
<activity
android:name=".GameActivity"
android:configChanges="orientation|keyboardHidden"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Exception states that it didn't find your GameActivity class. Check your Manifest and see if the name given there as the launcher activity (GameActivity) matches with the class that you have in your package, check the package names, etc. The exception has nothing to do (at least the piece that you have shown) with Cast.
Thanks for all the help. I solved by silly configuration. I created a libs folder and copied under GoogleCastSDKAndroid.jar (marked as Private Library). Compiled and it worked perfect!
Now, I just learned the casting function can't work because AVD runs a different IP address (in my case registered a 10.0.2.15) than my wifi segment (192.168.1.x). Therefore, the AVD can't see a chrome device.
I hope this last conclusion helps other people. The first was a mistake of configuration.
i am running one android application in which i am using ActionBar but from supported library for android 2.2
i have added two external jar file as a support libraries
android-support-v7-appcompact.jar
android-support-v13.jar
but when i run the sample in my device i getting following runtime error
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{com.example.android.navigationdrawerexample/com.example.android.navigationdrawerexample.NavMainActivity}:
java.lang.ClassNotFoundException:
com.example.android.navigationdrawerexample.NavMainActivity in loader
dalvik.system.PathClassLoader[/data/app/com.example.android.navigationdrawerexample-1.apk]
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2703)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2797)
at android.app.ActivityThread.access$2300(ActivityThread.java:135)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2132)
at android.os.Handler.dispatchMessage(Handler.java:99) at
android.os.Looper.loop(Looper.java:143) at
android.app.ActivityThread.main(ActivityThread.java:4914) at
java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:521) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) at
dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.example.android.navigationdrawerexample.NavMainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.android.navigationdrawerexample-1.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
at android.app.Instrumentation.newActivity(Instrumentation.java:1033)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2695)
here is the menifest file content
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.navigationdrawerexample"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application
android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
>
<activity android:name="NavMainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
order of jar files
You should not only look at errors but also at warnings (orange text color in eclipse logcat view). Dalvik class loading are often preceded by some interesting informations about why a class can't be loaded by the Dalvik, something like a super class not existing.
I get the following error from the emulator in Eclipse when I run an Android application...
"The application has stopped unexpectedly. Please try again"
There are no error icons appearing in the project folder in Eclipse. I have already tried...
Cleaning the Project
Android Tools > Fix Project Properties
Updating the Build Path
My Error Log is saying...
"java.lang.RuntimeException: Unable to instantiate activity ComponentInfo..."
The Error Log goes onto say...
"Caused by: java.lang.ClassNotFoundException..."
Just to note that I do not have a "Build.xml" file in my project folder but instead a "apktool.yml" if this makes any difference.
Any suggestions??
EDIT:
Here's the manifest file...
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="61" android:versionName="1.2.2" package="com.__.__"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application android:label="#string/app_name" android:icon="#drawable/ic_launcher">
<activity android:label="#string/app_name" android:name=".MTActivity" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="#string/app_name" android:name=".RCActivity" android:screenOrientation="portrait" />
...
Errors generated LogCat...
E/AndroidRuntime(6220): FATAL EXCEPTION: main
E/AndroidRuntime(6220): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ir.mtools/com.ir.mtools.MTActivity}: java.lang.ClassNotFoundException:
com.irtza.pulmtools.MTActivity in loader dalvik.system.PathClassLoader[/data/app/com.ir.mtools-1.apk]
E/AndroidRuntime(6220): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
E/AndroidRuntime(6220): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
E/AndroidRuntime(6220): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime(6220): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
E/AndroidRuntime(6220): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(6220): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime(6220): at android.app.ActivityThread.main(ActivityThread.java:3687)
E/AndroidRuntime(6220): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(6220): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(6220): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
E/AndroidRuntime(6220): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
E/AndroidRuntime(6220): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(6220): Caused by: java.lang.ClassNotFoundException: com.ir.mtools.MTActivity in loader dalvik.system.PathClassLoader[/data/app/com.ir.mtools-1.apk]
Whenever this happens it means your application has encountered a runtime exception, which means no errors will show up at compile time. In this case I'm guessing you have not declared the activity in the AndroidManifest.xml file, but without seeing more code that's only a guess.
java.lang.ClassNotFoundException: com.ir.mtools.MTActivity
Is com.ir.mtools.MTActivity this part of some library? if so have you included it in your build path ?