Reputation: 1315
I'm working on an Android application using the Aviary picture editing library, but have run into an issue. When run inside the debugger, everything runs great. However, when I run it on the phone, it crashes with a "java.lang.IllegalArugmentException: Unknow URL nulluuid/6d77d345......." error in the log. I'm pretty sure the error is related to the mSessionId variable. Here is the relevant code:
private void startFeather( Uri uri ) {
Log.d( LOG_TAG, "uri: " + uri );
Intent newIntent = new Intent( this, FeatherActivity.class );
newIntent.setData( uri );
newIntent.putExtra( "API_KEY", API_KEY );
newIntent.putExtra( "output-format", Bitmap.CompressFormat.JPEG.name() );
newIntent.putExtra( "output", Uri.parse(picDir + File.separator + "Final_" + getIntent().getStringExtra("file")));
newIntent.putExtra( "output-quality", 90 );
newIntent.putExtra( "tools-list",
new String[] {
FilterLoaderFactory.Filters.ENHANCE.name(), FilterLoaderFactory.Filters.EFFECTS.name(),
FilterLoaderFactory.Filters.STICKERS.name(), FilterLoaderFactory.Filters.ADJUST.name(),
FilterLoaderFactory.Filters.CROP.name(), FilterLoaderFactory.Filters.BRIGHTNESS.name(),
FilterLoaderFactory.Filters.CONTRAST.name(), FilterLoaderFactory.Filters.SATURATION.name(),
FilterLoaderFactory.Filters.SHARPNESS.name(), FilterLoaderFactory.Filters.DRAWING.name(),
FilterLoaderFactory.Filters.TEXT.name(), FilterLoaderFactory.Filters.MEME.name(),
FilterLoaderFactory.Filters.RED_EYE.name(), FilterLoaderFactory.Filters.WHITEN.name(),
FilterLoaderFactory.Filters.BLEMISH.name(), } );
final DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics( metrics );
final int max_size = Math.max( metrics.widthPixels, metrics.heightPixels );
newIntent.putExtra( "max-image-size", max_size );
newIntent.putExtra( "effect-enable-borders", true );
mSessionId = StringUtils.getSha256( System.currentTimeMillis() + API_KEY );
Log.d( LOG_TAG, "session: " + mSessionId + ", size: " + mSessionId.length() );
newIntent.putExtra( "output-hires-session-id", mSessionId );
startActivityForResult( newIntent, AVIARY_ACTIVITY );
}
I declare the mSessionId variable inside the class, but outside any functions.
private String mSessionId;
Any ideas what this could be? I've been stumped for hours.
Edit: Here is the call to startFeather():
Uri imagePath = Uri.parse(picDir + File.separator + getIntent().getStringExtra("file"));
startFeather(imagePath);
imagePath's value is: "/mnt/sdcard/XXXX/Pictures/dd00b97b-eebd-4780-a6c3-993bffdbee37.png"
Edit: Here is the logcat output:
05-09 15:28:34.654: D/CLIPBOARD(2965): Hide Clipboard dialog at Starting input: finished by someone else... !
05-09 15:28:35.365: V/XXXX(2965): initPath: dd00b97b-eebd-4780-a6c3-993bffdbee37.png
05-09 15:28:35.375: V/XXXX(2965): fileURI: file:///mnt/sdcard/XXXX/Pictures/dd00b97b-eebd-4780-a6c3-993bffdbee37.png
05-09 15:28:36.166: D/CLIPBOARD(2965): Hide Clipboard dialog at Starting input: finished by someone else... !
05-09 15:28:36.166: W/IInputConnectionWrapper(2965): showStatusIcon on inactive InputConnection
05-09 15:28:42.852: D/XXXX(2965): uri: /mnt/sdcard/XXXX/Pictures/dd00b97b-eebd-4780-a6c3-993bffdbee37.png
05-09 15:28:42.852: D/XXXX(2965): session: 5faf1fb832e59d18e1366f0f458f93a0d5fd3d5ff5a639faae990af4a0e2e7f1, size: 64
05-09 15:28:42.902: D/InputTransport(2965): Input channel constructed: name='407ec7b8 XXXX.app/XXXX.app.PhotoActivity (client)', ashmemFd=49, receivePipeFd=50, sendPipeFd=51
05-09 15:28:42.942: V/Localytics(2965): Opening new session
05-09 15:28:42.972: D/dalvikvm(2965): GC_EXTERNAL_ALLOC freed 134K, 47% free 2984K/5575K, external 3186K/3335K, paused 20ms
05-09 15:28:43.102: D/dalvikvm(2965): GC_EXTERNAL_ALLOC freed 87K, 46% free 3021K/5575K, external 5052K/5631K, paused 20ms
05-09 15:28:43.122: I/dalvikvm(2965): Could not find method com.aviary.android.feather.graphics.AnimatedRotateDrawable.getCallback, referenced from method com.aviary.android.feather.graphics.AnimatedRotateDrawable.invalidateDrawable
05-09 15:28:43.122: W/dalvikvm(2965): VFY: unable to resolve virtual method 4244: Lcom/aviary/android/feather/graphics/AnimatedRotateDrawable;.getCallback ()Landroid/graphics/drawable/Drawable$Callback;
05-09 15:28:43.122: D/dalvikvm(2965): VFY: replacing opcode 0x6e at 0x0006
05-09 15:28:43.122: D/dalvikvm(2965): VFY: dead code 0x0009-000e in Lcom/aviary/android/feather/graphics/AnimatedRotateDrawable;.invalidateDrawable (Landroid/graphics/drawable/Drawable;)V
05-09 15:28:43.122: I/dalvikvm(2965): Could not find method com.aviary.android.feather.graphics.AnimatedRotateDrawable.getCallback, referenced from method com.aviary.android.feather.graphics.AnimatedRotateDrawable.scheduleDrawable
05-09 15:28:43.122: W/dalvikvm(2965): VFY: unable to resolve virtual method 4244: Lcom/aviary/android/feather/graphics/AnimatedRotateDrawable;.getCallback ()Landroid/graphics/drawable/Drawable$Callback;
05-09 15:28:43.122: D/dalvikvm(2965): VFY: replacing opcode 0x6e at 0x0006
05-09 15:28:43.122: D/dalvikvm(2965): VFY: dead code 0x0009-000e in Lcom/aviary/android/feather/graphics/AnimatedRotateDrawable;.scheduleDrawable (Landroid/graphics/drawable/Drawable;Ljava/lang/Runnable;J)V
05-09 15:28:43.122: I/dalvikvm(2965): Could not find method com.aviary.android.feather.graphics.AnimatedRotateDrawable.getCallback, referenced from method com.aviary.android.feather.graphics.AnimatedRotateDrawable.unscheduleDrawable
05-09 15:28:43.122: W/dalvikvm(2965): VFY: unable to resolve virtual method 4244: Lcom/aviary/android/feather/graphics/AnimatedRotateDrawable;.getCallback ()Landroid/graphics/drawable/Drawable$Callback;
05-09 15:28:43.122: D/dalvikvm(2965): VFY: replacing opcode 0x6e at 0x0006
05-09 15:28:43.122: D/dalvikvm(2965): VFY: dead code 0x0009-000e in Lcom/aviary/android/feather/graphics/AnimatedRotateDrawable;.unscheduleDrawable (Landroid/graphics/drawable/Drawable;Ljava/lang/Runnable;)V
05-09 15:28:43.122: I/dalvikvm(2965): Could not find method android.app.ActivityManager.getLargeMemoryClass, referenced from method com.aviary.android.feather.Constants.initContext
05-09 15:28:43.122: W/dalvikvm(2965): VFY: unable to resolve virtual method 36: Landroid/app/ActivityManager;.getLargeMemoryClass ()I
05-09 15:28:43.132: D/dalvikvm(2965): VFY: replacing opcode 0x6e at 0x0024
05-09 15:28:43.132: D/dalvikvm(2965): VFY: dead code 0x0027-002e in Lcom/aviary/android/feather/Constants;.initContext (Landroid/content/Context;)V
05-09 15:28:43.132: D/dalvikvm(2965): VFY: dead code 0x0052-0053 in Lcom/aviary/android/feather/Constants;.initContext (Landroid/content/Context;)V
05-09 15:28:43.132: I/feather(2965): screen size: 480x800
05-09 15:28:43.132: D/dalvikvm(2965): No JNI_OnLoad found in /system/lib/libcutils.so 0x4051e4e8, skipping init
05-09 15:28:43.132: D/dalvikvm(2965): Trying to load lib /data/data/XXXX.app/lib/libstlport_shared.so 0x4051e4e8
05-09 15:28:43.132: D/dalvikvm(2965): Added shared lib /data/data/XXXX.app/lib/libstlport_shared.so 0x4051e4e8
05-09 15:28:43.132: D/dalvikvm(2965): No JNI_OnLoad found in /data/data/XXXX.app/lib/libstlport_shared.so 0x4051e4e8, skipping init
05-09 15:28:43.132: D/dalvikvm(2965): Trying to load lib /data/data/XXXX.app/lib/libfeathernative.so 0x4051e4e8
05-09 15:28:43.132: D/dalvikvm(2965): Added shared lib /data/data/XXXX.app/lib/libfeathernative.so 0x4051e4e8
05-09 15:28:43.142: E/filter-native(2965): cpu: armv7? 1
05-09 15:28:43.142: E/filter-native(2965): cpu: fpu? 1
05-09 15:28:43.142: E/filter-native(2965): cpu: neon? 1
05-09 15:28:43.202: D/dalvikvm(2965): GC_CONCURRENT freed 143K, 46% free 3089K/5639K, external 5403K/6381K, paused 2ms+2ms
05-09 15:28:43.202: E/feather(2965): [FeatherActivity] , MAX MEMORY, 64
05-09 15:28:43.202: D/InputTransport(2965): Input channel constructed: name='40801d90 XXXX.app/com.aviary.android.feather.FeatherActivity (client)', ashmemFd=64, receivePipeFd=65, sendPipeFd=66
05-09 15:28:43.243: D/dalvikvm(2965): GC_EXTERNAL_ALLOC freed 67K, 47% free 3112K/5767K, external 5395K/6381K, paused 26ms
05-09 15:28:43.793: I/image(2965): setImageBitmap: android.graphics.Bitmap@40635790
05-09 15:28:43.793: E/feather(2965): [FeatherActivity] , original.size: 2448x3264
05-09 15:28:43.793: E/feather(2965): [FeatherActivity] , final.size: 600x800
05-09 15:28:43.793: W/dalvikvm(2965): threadid=14: thread exiting with uncaught exception (group=0x4001e578)
05-09 15:28:43.803: E/AndroidRuntime(2965): FATAL EXCEPTION: Service[hiresService]
05-09 15:28:43.803: E/AndroidRuntime(2965): java.lang.IllegalArgumentException: Unknown URL nulluuid/5faf1fb832e59d18e1366f0f458f93a0d5fd3d5ff5a639faae990af4a0e2e7f1
05-09 15:28:43.803: E/AndroidRuntime(2965): at android.content.ContentResolver.insert(ContentResolver.java:600)
05-09 15:28:43.803: E/AndroidRuntime(2965): at com.aviary.android.feather.library.services.HiResService$1.run(HiResService.java:120)
05-09 15:28:43.803: E/AndroidRuntime(2965): at android.os.Handler.handleCallback(Handler.java:587)
05-09 15:28:43.803: E/AndroidRuntime(2965): at android.os.Handler.dispatchMessage(Handler.java:92)
05-09 15:28:43.803: E/AndroidRuntime(2965): at android.os.Looper.loop(Looper.java:130)
05-09 15:28:43.803: E/AndroidRuntime(2965): at android.os.HandlerThread.run(HandlerThread.java:60)
05-09 15:28:44.013: D/InputTransport(2965): Input channel constructed: name='408ab4f0 Toast (client)', ashmemFd=75, receivePipeFd=76, sendPipeFd=77
05-09 15:28:44.123: D/InputTransport(2965): Input channel destroyed: name='40801d90 XXXX.app/com.aviary.android.feather.FeatherActivity (client)', ashmemFd=64, receivePipeFd=65, sendPipeFd=66
05-09 15:28:44.123: D/InputTransport(2965): Input channel destroyed: name='407ec7b8 XXXX.app/XXXX.app.PhotoActivity (client)', ashmemFd=49, receivePipeFd=50, sendPipeFd=51
05-09 15:28:45.995: D/InputTransport(2965): Input channel destroyed: name='408ab4f0 Toast (client)', ashmemFd=75, receivePipeFd=76, sendPipeFd=77
From experimenting, I've found that the problem definitely lies with the mSessionId = StringUtils.getSha256( System.currentTimeMillis() + API_KEY ); line. If I comment it out (disabling Hi-Res processing) it works fine.
Upvotes: 2
Views: 2825
Reputation: 1035
For enabling of "Hi-Resolution Image Editing" are required additional steps, see paragraph 10 Hi-Resolution Image Editing in offcial documentation
Upvotes: 0
Reputation: 810
For future reference... if someone else has this error, you have to add this in the Manifest file:
<!-- Required for the hi-res image processing -->
<!-- authorities can have the value you prefer -->
<provider
android:name="com.aviary.android.feather.library.providers.FeatherContentProvider"
android:exported="false"
android:authorities="com.aviary.launcher.HiResProvider">
</provider>
Upvotes: 4
Reputation: 618
I ran into the same problem too. The solution for me is to increase the memory both heap size and perm for eclipse. It seems that eclipse ADT won't be able to build apk properly, when it does not have enough memory. This will happen when the android project include large jar lib such as aviary.
To increase the memory of eclipse, edit your eclipse.ini and change these value: -XX:MaxPermSize=512m -Xms512m -Xmx1024m
Hope this help.
Upvotes: 2
Reputation: 12900
newIntent.putExtra( "output", Uri.parse( "file://" + mOutputFile.getAbsolutePath() ) );
I guess, we are in need of more code, to answer your question. One thing I noticed though, is that your Uri doesn't start with the "file://" prefix, like shown in the documentation.
Anyway, I think the problem is related to the Uri, since the error is complaining about an IllegalArgumentException when inserting an Url in the contentprovider.
Doublecheck, your Uri exists on the device, and that it start with "file://" and post us the results
Upvotes: 0