I've installed eclipse in a new computer with windows 8, I've copy the workspace from my old PC and now I can open the projects and work with them normally, but when I try to install the apk in a device or in the emulator, appears an error in the console:
Installation failed due to invalid APK file!
Please check logcat output for more details.
Launch canceled!
This is the logcat:
> 05-30 13:11:54.054: W/PackageParser(3644): Unable to read AndroidManifest.xml of /data/local/tmp/J i A.apk
05-30 13:11:54.054: W/PackageParser(3644): java.io.FileNotFoundException: AndroidManifest.xml
05-30 13:11:54.054: W/PackageParser(3644): at android.content.res.AssetManager.openXmlAssetNative(Native Method)
05-30 13:11:54.054: W/PackageParser(3644): at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:487)
05-30 13:11:54.054: W/PackageParser(3644): at android.content.res.AssetManager.openXmlResourceParser(AssetManager.java:455)
05-30 13:11:54.054: W/PackageParser(3644): at android.content.pm.PackageParser.parsePackageLite(PackageParser.java:649)
05-30 13:11:54.054: W/PackageParser(3644): at com.android.defcontainer.DefaultContainerService$1.getMinimalPackageInfo(DefaultContainerService.java:144)
05-30 13:11:54.054: W/PackageParser(3644): at com.android.internal.app.IMediaContainerService$Stub.onTransact(IMediaContainerService.java:102)
05-30 13:11:54.054: W/PackageParser(3644): at android.os.Binder.execTransact(Binder.java:338)
05-30 13:11:54.054: W/PackageParser(3644): at dalvik.system.NativeStart.run(Native Method)
05-30 13:11:54.054: W/DefContainer(3644): Failed to parse package
05-30 13:11:54.062: I/ApplicationPolicy(187): isApplicationInstallationEnabled
05-30 13:11:54.062: W/PackageManager(187): verifying app can be installed or not
05-30 13:11:54.062: W/PackageParser(3644): Unable to read AndroidManifest.xml of /data/local/tmp/J i A.apk
05-30 13:11:54.062: W/PackageParser(3644): java.io.FileNotFoundException: AndroidManifest.xml
05-30 13:11:54.062: W/PackageParser(3644): at android.content.res.AssetManager.openXmlAssetNative(Native Method)
05-30 13:11:54.062: W/PackageParser(3644): at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:487)
05-30 13:11:54.062: W/PackageParser(3644): at android.content.res.AssetManager.openXmlResourceParser(AssetManager.java:455)
05-30 13:11:54.062: W/PackageParser(3644): at android.content.pm.PackageParser.parsePackageLite(PackageParser.java:649)
05-30 13:11:54.062: W/PackageParser(3644): at com.android.defcontainer.DefaultContainerService$1.getMinimalPackageInfo(DefaultContainerService.java:144)
05-30 13:11:54.062: W/PackageParser(3644): at com.android.internal.app.IMediaContainerService$Stub.onTransact(IMediaContainerService.java:102)
05-30 13:11:54.062: W/PackageParser(3644): at android.os.Binder.execTransact(Binder.java:338)
05-30 13:11:54.062: W/PackageParser(3644): at dalvik.system.NativeStart.run(Native Method)
05-30 13:11:54.062: W/DefContainer(3644): Failed to parse package
05-30 13:11:54.062: W/ActivityManager(187): No content provider found for permission revoke: file:///data/local/tmp/J i A.apk
If I try to export the application to generate the apk file, appears a dialog that says "Failed to export application".
Any idea to solve this? I can't test my app or generate the apk in anyway.
Check the target SDK for the android app and make sure you have that SDK version installed. You can change it in project properties.
Related
My client has provided a .so pre-built shared library. Which supposed to load with libpd, since libpd controller requires m4aPlayer module to load. So I put libm4aPlayer.so inside jniLibs(also tried libs) folder under app > main and then I added this in my build.gradle
defaultConfig {
ndk{
moduleName "m4aPlayer"
}
}
...
sourceSets {
main {
jni {
srcDirs = []
}
jniLibs {
srcDir 'libs'
}
}
}
And then in my AudioService class (where I initPd() and loadPatch()) I am trying to call native prebuilt library that client provided by doing this
patchFile = new File(pdFile[0].mFile.getParent(), "pd/_main.pd");
//System.loadLibrary("pd");
System.loadLibrary("m4aPlayer");
PdBase.openPatch(patchFile);
PdBase.sendFloat("fadeTime", 12f);
Everytime I try to open the patch file(_main.pd) I get error from PD controller saying "m4aPlayer couldn't create". But I am trying to load the library still pd throws this error. It does play other audio fine(where libpd doesnt require m4aPlayer glue.)
Stack trace
05-30 21:48:05.840 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.840 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.840 6589-6589/com.test.test I/PdUiDispatcher: print: m4aPlayer
05-30 21:48:05.840 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.840 6589-6589/com.test.test I/PdUiDispatcher: print: error: ... couldn't create
05-30 21:48:05.840 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.840 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.840 6589-6589/com.test.test I/PdUiDispatcher: print: m4aPlayer
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print: error: ... couldn't create
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print: m4aPlayer
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print: error: ... couldn't create
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print: fadeTime: 12
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print: fadeDelay: 3
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print: curve: 30
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print: musicVol: 1.5
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print: voiceVol: 1.5
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print: voiceGender: 1
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print: isRandom: 1
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print: suggestionsVO: 1
05-30 21:48:05.841 6589-6589/com.test.test I/PdUiDispatcher: print: availableSoundscapes:
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print: 2
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print: 3
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print: 4
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print: 5
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print: 6
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print: 7
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print: 8
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.842 6589-6589/com.test.test I/PdUiDispatcher: print: 9
05-30 21:48:05.843 6589-6589/com.test.test I/PdUiDispatcher: print:
05-30 21:48:05.843 6589-6589/com.test.test I/PdUiDispatcher: print: module: 2
05-30 21:48:05.843 6589-6589/com.test.test I/PdUiDispatcher: print: INTO-Q: 0
05-30 21:48:05.843 6589-6589/com.test.test I/PdUiDispatcher: print: soundscape: 5
05-30 21:48:05.843 6589-6589/com.test.test I/PdUiDispatcher: print: toApp-isThisFileOK: p5intro0
I also tried to check inside the app to make sure library is being copied or not. So I went to
data/data/package_name/lib
You don't need to call System.loadLibrary() to load pure data externals.
Have a look at the PdTest example on the pd-for-android repository as a reference to how the "helloworld.c" external is used there. You could use that as a template for your own project to keep things simple at first and validate that the pure data patch can load your libm4aPlayer external correctly.
Also- you're mentioning .m files. I guess you're compiling Objective C then? I haven't seen anyone doing that with pd-for-android so I'm not sure if that will work.
This answer may provide some clues or tips: https://stackoverflow.com/a/27523384/901597
there are three options:
Pd cannot find the library file: try using a full path (or confirm that other externals, like [bonk~] can be loaded)
the binary misses some dependencies (check with some android equivalent of ldd)
the binary is not a Pd-external at all (despite what your customer claims)
to debug the last two options, you might want to raise verbosity and or monitor the stderr (and probably stdout) of your app as well.
I got this error logout sometimes, I know this logcat means my ABCModel is not serializable but it is. All the model instances which are used inside ABCModel are all serialized,
Here is the complete Logcat:
05-30 11:38:49.249: E/AndroidRuntime(4305): FATAL EXCEPTION: main
05-30 11:38:49.249: E/AndroidRuntime(4305): java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name =
com.kxs.project.model.ABCModel)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeSerializable(Parcel.java:1181)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeValue(Parcel.java:1135)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeMapInternal(Parcel.java:493)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Bundle.writeToParcel(Bundle.java:1612)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeBundle(Parcel.java:507)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.support.v4.app.FragmentState.writeToParcel(Fragment.java:132)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeTypedArray(Parcel.java:1004)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.support.v4.app.FragmentManagerState.writeToParcel(FragmentManager.java:368)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeParcelable(Parcel.java:1156)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeValue(Parcel.java:1075)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeMapInternal(Parcel.java:493)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Bundle.writeToParcel(Bundle.java:1612)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeBundle(Parcel.java:507)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:1919)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityThread.handleStopActivity(ActivityThread.java:2869)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityThread.access$900(ActivityThread.java:124)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1165)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Looper.loop(Looper.java:137)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityThread.main(ActivityThread.java:4436)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 11:38:49.249: E/AndroidRuntime(4305): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-30 11:38:49.249: E/AndroidRuntime(4305): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-30 11:38:49.249: E/AndroidRuntime(4305): at dalvik.system.NativeStart.main(Native Method)
05-30 11:38:49.249: E/AndroidRuntime(4305): Caused by: java.io.NotSerializableException: org.json.JSONArray
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1364)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeSerializable(Parcel.java:1176)
05-30 11:38:49.249: E/AndroidRuntime(4305): ... 24 more
05-30 11:38:49.249: E/AndroidRuntime(4305): Caused by: java.io.NotSerializableException: org.json.JSONArray
Probably somewhere in your model contains the JSONArray object. It is not serializable: JSONArray source code
I have a MainActivity which holds TabHost one of its tabs is CardHolderActivity which also contains a TabHost with two tabs (and they are Activities also). Everything goes fine until after I set in one of the latest - MyCardsActivity - the SaveOnInstanceState where I put a list of my data to outState bundle. I'm starting a lot of other apps so my app is being killed. After I start it again from the list of recently opened application I'm getting a NullPointerException, here is the log:
05-30 12:35:06.032: I/CrashLogger(28147): java.lang.RuntimeException: Unable to start activity ComponentInfo{my.package/my.package.activities.MainActivity}: java.lang.RuntimeException: Unable to start activity ComponentInfo{my.package/my.package.activities.CardsHolderActivity}: java.lang.RuntimeException: Unable to start activity ComponentInfo{my.package/my.package.activities.MyCardsActivity}: java.lang.NullPointerException
05-30 12:35:06.032: I/CrashLogger(28147): --------- Stack trace ---------
05-30 12:35:06.032: I/CrashLogger(28147): android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
05-30 12:35:06.032: I/CrashLogger(28147): android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
05-30 12:35:06.032: I/CrashLogger(28147): android.app.ActivityThread.access$600(ActivityThread.java:141)
05-30 12:35:06.032: I/CrashLogger(28147): android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
05-30 12:35:06.032: I/CrashLogger(28147): android.os.Handler.dispatchMessage(Handler.java:99)
05-30 12:35:06.032: I/CrashLogger(28147): android.os.Looper.loop(Looper.java:137)
05-30 12:35:06.032: I/CrashLogger(28147): android.app.ActivityThread.main(ActivityThread.java:5041)
05-30 12:35:06.032: I/CrashLogger(28147): java.lang.reflect.Method.invokeNative(Native Method)
05-30 12:35:06.032: I/CrashLogger(28147): java.lang.reflect.Method.invoke(Method.java:511)
05-30 12:35:06.032: I/CrashLogger(28147): com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-30 12:35:06.032: I/CrashLogger(28147): com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-30 12:35:06.032: I/CrashLogger(28147): dalvik.system.NativeStart.main(Native Method)
Here is the code after which I have this:
#Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (cards != null)
outState.putSerializable(EXTRA_MY_CARDS, cards);
}
The cards is a static variable of TreeSet<Card> type and Card class implements Serializable.
Can you guys tell me why this happens?
Also, I'm very surprised this happens after restoring the application for killed state, there is no any issues on the onSaveInstanceState() at all. And I'm not retrieving the date nor in onRestoreInstanceState() and onCreate() neither.
If cards is static, why do you need to write it in onSavedInstanceState? Being static, it will be tied to Class object, not to Activity instance.
But be very careful when using static within Activities as that leads to memory leaks.
I'm attempting to put together a library for Twitter feeds and I've got most of it working, but I'm running into an issue where links in my text are crashing when clicked, and I wanted to see if anyone could point me in the right direction for fixing this.
The main text field of my tweet is defined in XML as this:
<TextView
android:textColor="#android:color/black"
android:id="#+id/TweetUITweetTextTextView"
android:padding="#dimen/tweetTextPadding"
android:layout_toRightOf="#+id/TweetUIUserProfileImageView"
android:layout_below="#+id/TweetUIUsernameTextView"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:linksClickable="true"
android:autoLink="web"
android:text="#null" />
And this is located inside of a relative layout that I expand into a custom "TweetView" class.
The TweetView takes a Tweet Object that is basically a set of strings that contain the information parsed from a JSON query and sets those strings (In this case, the main text from the Tweet with anchor tags and whatnot from the URL metadata in the Twitter JSON feed) to the textview with this:
if( tweet.tweetText != null && tweet.tweetText != "" )
tweetTextTextView.setText( Html.fromHtml( tweet.tweetTextWithLinks ) );
else
tweetTextTextView.setText( "" );
As for my error stack on crash, I have this:
05-30 14:42:22.206: E/InputEventReceiver(22150): Exception dispatching input event.
05-30 14:42:22.206: E/MessageQueue-JNI(22150): Exception in MessageQueue callback: handleReceiveCallback
05-30 14:42:22.216: E/MessageQueue-JNI(22150): android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.app.ContextImpl.startActivity(ContextImpl.java:944)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.app.ContextImpl.startActivity(ContextImpl.java:931)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.content.ContextWrapper.startActivity(ContextWrapper.java:284)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.text.style.URLSpan.onClick(URLSpan.java:62)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.text.method.LinkMovementMethod.onTouchEvent(LinkMovementMethod.java:212)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.widget.TextView.onTouchEvent(TextView.java:7536)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.View.dispatchTouchEvent(View.java:7246)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1953)
.....
Thank you!
Probably you pass "wrong" context in your adapter. E.g. application context instead of activity context.
i searched for this Problem, and i found some stackoverflow Questions about the same but without any idea how to resolve the problem.
I created an activity and i want to add a really small mapview (like 140w X 70h). It is only to show a small preview of where the place is. When you click this little mapview you get a new inflate to a new activity with the hole map.
MapView:
<com.google.android.maps.MapView android:id="#+id/mapview"
android:layout_width="140dip"
android:layout_height="80dip"
android:layout_below="#id/attributes"
android:layout_alignParentRight="true"
android:apiKey="****"
android:paddingBottom="60dp"/>
LogCat:
05-30 14:34:53.758: ERROR/dalvikvm(1608): Out of memory: Heap Size=4039KB, Allocated=2768KB, Bitmap Size=625KB
05-30 14:34:53.758: DEBUG/AndroidRuntime(1608): Shutting down VM
05-30 14:34:53.758: WARN/dalvikvm(1608): threadid=1: thread exiting with uncaught exception (group=0x400259f8)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): FATAL EXCEPTION: main
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): java.lang.OutOfMemoryError
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at com.google.googlenav.map.Map.resize(Unknown Source)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at com.google.android.maps.MapView.onMeasure(MapView.java:554)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.View.measure(View.java:8172)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:578)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:362)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.View.measure(View.java:8172)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:989)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.ScrollView.onMeasure(ScrollView.java:286)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.View.measure(View.java:8172)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:578)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:362)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.View.measure(View.java:8172)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.View.measure(View.java:8172)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.View.measure(View.java:8172)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.ViewRoot.performTraversals(ViewRoot.java:805)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.os.Looper.loop(Looper.java:144)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.app.ActivityThread.main(ActivityThread.java:4937)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at java.lang.reflect.Method.invoke(Method.java:521)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at dalvik.system.NativeStart.main(Native Method)
this is the error. When i use fill_parent it works, but i dont want a mapview with fill_parent.
Maybe you guys know another way to get a preview small image of the current (or given) position on the map as image.
Isn't it possible to show a small mapview ?
thanks
If you just want to show a static map without interaction I recommend the static map api from google. You can define markers, the center, the size and some labels and it returns a generated image that can be easily shown inside a ImageView. The benefit of this: You don't have to invoke a complete MapView for just a small map image. No overhead of memory or user interaction. Perfect for the scenario you have.