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.
Related
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'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'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.
In one of my activities you can click on an image button and a dialog opens up to ask you to open up the Gallery. Once opened up you can click on one of those images in your gallery.
What I want that the clicked image is set as the image of the image button. This image should stay there even when the user kills the app (when he opens up the app again the chosen image should still be there).
I chose to do all this work with the shared preferences but can't get it working. I get an error when I click on an image in the gallery. Any suggestions??
UPDATE: The error I receive is:
Unfortunately, the process com.myname.android has stopped
Here is my code, beginning with the onActivityResult:
private String selectedImagePath;
private String mFileName;
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == PICK_FROM_FILE) {
Uri selectedImageUri = data.getData();
selectedImagePath = getPath(selectedImageUri);
Log.v("IMAGE PATH====>>>> ",selectedImagePath);
}
storePath();
retrievePath();
convertPathToImage();
}
}
private void storePath() {
final SharedPreferences sPreference = getSharedPreferences(
"pref_key", MODE_PRIVATE);
final Editor spEditor = sPreference.edit();
spEditor.putString("img_path", mFileName);
spEditor.commit();
}
private void retrievePath() {
final SharedPreferences sharedPreference = getSharedPreferences(
"pref_key", MODE_PRIVATE);
if (sharedPreference.contains("img_path")) {
mFileName = sharedPreference.getString("img_path",
null);
}
}
private void convertPathToImage() {
File imgFile = new File(mFileName);
if(imgFile.exists()){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
ImageButton myImage = (ImageButton) findViewById(R.id.image);
myImage.setImageBitmap(myBitmap);
}
}
And here is the LogCat:
05-30 15:27:14.567: D/dalvikvm(634): GC_CONCURRENT freed 1K, 3% free 11478K/11783K, paused 5ms+4ms
05-30 15:27:14.597: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:14.617: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:14.926: D/gralloc_goldfish(634): Emulator without GPU emulation detected.
05-30 15:27:26.767: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:26.877: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:30.616: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:30.626: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:32.086: W/IInputConnectionWrapper(634): showStatusIcon on inactive InputConnection
05-30 15:27:33.366: E/ActivityThread(634): Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1#4155da80 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-30 15:27:33.366: E/ActivityThread(634): android.app.IntentReceiverLeaked: Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1#4155da80 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-30 15:27:33.366: E/ActivityThread(634): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:763)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:567)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1043)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1030)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1024)
05-30 15:27:33.366: E/ActivityThread(634): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:341)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.content.PackageMonitor.register(PackageMonitor.java:65)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.app.ResolverActivity.onCreate(ResolverActivity.java:99)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.app.ChooserActivity.onCreate(ChooserActivity.java:53)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.Activity.performCreate(Activity.java:4465)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-30 15:27:33.366: E/ActivityThread(634): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 15:27:33.366: E/ActivityThread(634): at android.os.Looper.loop(Looper.java:137)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-30 15:27:33.366: E/ActivityThread(634): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 15:27:33.366: E/ActivityThread(634): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-30 15:27:33.366: E/ActivityThread(634): at dalvik.system.NativeStart.main(Native Method)
05-30 15:27:35.987: V/IMAGE PATH====>>>>(634): /mnt/sdcard/Mercedes_SLS_AMG.jpg
05-30 15:27:36.176: D/AndroidRuntime(634): Shutting down VM
05-30 15:27:36.176: W/dalvikvm(634): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
05-30 15:27:36.206: E/AndroidRuntime(634): FATAL EXCEPTION: main
05-30 15:27:36.206: E/AndroidRuntime(634): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { dat=content://media/external/images/media/20 }} to activity {com.xyz.android.taskreminder/com.xyz.android.taskreminder.ReminderEditActivity}: java.lang.NullPointerException
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.deliverResults(ActivityThread.java:2980)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3023)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.access$1100(ActivityThread.java:123)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1177)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.os.Looper.loop(Looper.java:137)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-30 15:27:36.206: E/AndroidRuntime(634): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 15:27:36.206: E/AndroidRuntime(634): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-30 15:27:36.206: E/AndroidRuntime(634): at dalvik.system.NativeStart.main(Native Method)
05-30 15:27:36.206: E/AndroidRuntime(634): Caused by: java.lang.NullPointerException
05-30 15:27:36.206: E/AndroidRuntime(634): at java.io.File.fixSlashes(File.java:185)
05-30 15:27:36.206: E/AndroidRuntime(634): at java.io.File.<init>(File.java:134)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.xyz.android.taskreminder.ReminderEditActivity.convertPathToImage(ReminderEditActivity.java:249)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.xyz.android.taskreminder.ReminderEditActivity.onActivityResult(ReminderEditActivity.java:227)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.Activity.dispatchActivityResult(Activity.java:4649)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.deliverResults(ActivityThread.java:2976)
05-30 15:27:36.206: E/AndroidRuntime(634): ... 11 more
05-30 15:27:36.376: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:36.396: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:36.787: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:36.847: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:37.386: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:37.406: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:37.887: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:37.947: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:38.396: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:38.416: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:38.897: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:38.927: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:39.406: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:39.426: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:39.917: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:39.927: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:40.426: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:40.446: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:40.917: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:40.947: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:41.426: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:41.447: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:41.937: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:41.977: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:42.446: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:42.467: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:42.937: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:42.956: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:43.446: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:43.467: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:43.947: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:43.976: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:44.456: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:44.477: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:44.966: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:44.986: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:45.466: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:45.487: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1#4155da80 that was originally registered here. Are you missing a call to unregisterReceiver()?
This is probably a bug in Android. See http://code.google.com/p/android/issues/detail?id=29399. It shouldn't effect the app though which should still be able to get a result back from the gallery.
05-30 15:27:36.206: E/AndroidRuntime(634): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { dat=content://media/external/images/media/20 }} to activity {com.ndroidstudios.android.taskreminder/com.ndroidstudios.android.taskreminder.ReminderEditActivity}: java.lang.NullPointerException
...
05-30 15:27:36.206: E/AndroidRuntime(634): Caused by: java.lang.NullPointerException
This is the problem. mFileName is null when you try to use it to create a new File. In retrievePath, when you try to pull "img_path" out of your preferences the default value is null, so I'm guessing it's getting set to null there. Check in the debugger to make sure mFileName is getting set to a valid String from your preferences.
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.