Using java library : Package does not exist error

Expert

New Member
Licensed User
Longtime User
I'm trying to use a working java project as library in B4A. I've followed the instructions given in Create Simple Library to export .jar file & to generate xml file.:sign0104:

But when i try to use that object in a B4A project it throws error while compiling which says :
Parsing code. 0.00
Compiling code. 0.08
Compiling layouts code. 0.00
Generating R file. 0.31
Compiling generated Java code. Error
javac 1.7.0_03
src\b4a\example\main.java:232: error: package com.example.finalimagezoom does not exist
public com.example.finalimagezoom.ImageZoomWrapper _it = null;
^
1 error

I'm clueless with what could have went wrong. Any idea as to how can i overcome this issue.Please help :sign0163:
 

warwound

Expert
Licensed User
Longtime User
javac 1.7.0_03

You're compiling the library using java 7, there's many reports of problems with java 7. Class not found type exceptions when you compile with java 7 are common.

The solution is to compile with java 6.

Martin.
 
Upvote 0

Expert

New Member
Licensed User
Longtime User
Thanks Martin.

But I still get the same error even after changing path config to point to jdk1.6 javac.exe.
 
Last edited:
Upvote 0

Expert

New Member
Licensed User
Longtime User
No .class files ,only .java files are there.

EDIT: Thanks Erel. It is fixed now.
 
Last edited:
Upvote 0

warwound

Expert
Licensed User
Longtime User
You can also decompile the APK file using dex2jar.
dex2jar will create a JAR file which contains the java classes that have been compiled into your APK.

You can open this JAR with JD-GUI.

Now you can see those java classes have been compiled into the APK.

(Erel's advise will show you which classes have been compiled into your B4A library JAR, this solution will show you which classes have been compiled into the APK).

Martin.
 
Upvote 0

Expert

New Member
Licensed User
Longtime User
Yes i had not checked "Export generated class files and resources". Now it is working fine.Thanks a lot Erel.
 
Last edited:
Upvote 0

romario11

Member
Licensed User
Longtime User
hey i have the same problem
B4A line: 899
StatusCursor=DownloadManager1.Query(DownloadManagerQuery1)
javac 1.7.0_21
src\Ideafix\Ideafix\main.java:478: error: package android.app.DownloadManager does not exist
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
hey i have the same problem
B4A line: 899
StatusCursor=DownloadManager1.Query(DownloadManagerQuery1)
javac 1.7.0_21
src\Ideafix\Ideafix\main.java:478: error: package android.app.DownloadManager does not exist

Which version of Android are you trying to run this on?

DownloadManager requires a minimum Android API level of 9 (Gingerbread), some features of the library require higher API levels.

http://www.b4x.com/forum/additional...updates/22306-downloadmanager.html#post129464

Martin.
 
Upvote 0
Top