Android Question Failed resolution of: Landroid/support/media/ExifInterface;

Alain75

Member
Hi,

I tried to use @DonManfred exif wrapper but program crashs with title reason. I added the line below in the project region :
Project Attributes:
#AdditionalJar: com.android.support:exifinterface

I also checked the environment with the sdkmanager. It seems I installed the awaited exif library :



But it still crashs on the line exf2.Initialize whereas line exf.Initialize works... When I use the old library jpegUtils, I got the exif informations...
B4X:
    Dim p As B4XView = Tools.xui.CreatePanel(""), uri As Uri, cr As ContentResolver, c As Cursor
    p.SetLayoutAnimated(0,0,0,100%x,60dip)
    p.LoadLayout("Ligne")
    
    Dim in As InputStream    = File.OpenInput("ContentDir",enr)
    Dim out As OutputStream    = File.OpenOutput(File.DirInternal, "temp", False)
    File.Copy2(in, out)
    out.Close
    ICN.SetBackgroundImage(LoadBitmapResize(File.DirInternal, "temp",ICN.Width,ICN.Height,False))
    
    cr.Initialize("")
    uri.Parse(enr)
    c = cr.Query(uri,Null,Null,Null,Null)
    c.Position = 0

    NOM.Text = c.GetString("_display_name")
    DAT.Text = Tools.d2s(c.GetString("last_modified"),"")
    SZE.Text = Tools.n2s(c.GetString("_size")," ","")
    
    exf.Initialize(File.DirInternal,"temp")
    Log("GPS:"&exf.getAttribute(exf.TAG_GPS_LATITUDE)&","&exf.getAttribute(exf.TAG_GPS_LONGITUDE))
    
    exf2.Initialize("EXF",File.Combine(File.DirInternal,"temp"))
    Dim m As Map = exf2.GetAllAttributes
Any help ?
Thanks !
 

Alain75

Member
In fact, I forgot to tell that I am writing a very simple jpg compressor so that I need to get and keep original date, time and of course GPS informations (that's why I need to get exif informations) of the file.

The log :
B4X:
main_loadimage (java line: 549)
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/media/ExifInterface;
    at de.donmanfred.ExifInterfaceWrapper.Initialize(ExifInterfaceWrapper.java:242)
    at b4a.jpgsizer.main._loadimage(main.java:549)
    at b4a.jpgsizer.main$ResumableSub_StartActivityForResult.resume(main.java:861)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:275)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:215)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
    at anywheresoftware.b4j.object.JavaObject$1.invoke(JavaObject.java:238)
    at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
    at $Proxy1.ResultArrived(Unknown Source)
    at anywheresoftware.b4a.BA$4.run(BA.java:593)
    at anywheresoftware.b4a.BA.setActivityPaused(BA.java:467)
    at b4a.jpgsizer.main$ResumeMessage.run(main.java:313)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:246)
    at android.app.ActivityThread.main(ActivityThread.java:8653)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: java.lang.ClassNotFoundException: android.support.media.ExifInterface
    ... 19 more
Thanks a lot
 
Upvote 0

Alain75

Member
Moreover, I tried to use SimpleMediaManager with its internal version 1.14 or with external library 1.17 I downloaded but both produce an error in the log when I simply choose the library:
 

Attachments

  • Image.jpg
    57.9 KB · Views: 78
Upvote 0

Alain75

Member
Found All my programs have an activity to configure the application which is called "Params", conflicting with something in the library
 
Upvote 0

Alain75

Member
Android support packages are part of the old SDK.

Starting from Android 7, exif is part of the core SDK. You can use SimpleMediaManager to load jpeg images with the correct orientation.
I found in the library the very simple way to read exif metadata for orientation, GPSLatitudeRef, GPSLatitude, GPSLongitudeRef, GPSLongitude with an InputStream. I hope I can also write them with an OutputStream
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…