Java Question Simple Library Compiler and @DependsOn


Well-Known Member
Licensed User
I am using the Simple Library Compiler to build a wrapper for Amazon ads. I'm basing everything on the AdMob wrapper source code posted by Erel several years ago.

I need to reference an external jar. I see the @DependsOn attribute to include in the Java file. However when I add this to the Java file and compile in the Simple Library Compiler I receive the following error (the image below shows the Simple Library Compiler and output).

Starting step: Compiling Java code.
javac 1.7.0_45
C:\Users\Barry\AndroidDev\Basic4Android\SimpleLibraryCompiler\AmazonAds\src\canalrun\b4a\amznwrapper\ error: cannot find symbol
  symbol: class DependsOn
1 error


I have also attached my Java file. Below is the portion that generates the error.

@Events(values={"ReceiveAd", "FailedToReceiveAd (ErrorCode As String)"})
@Permissions(values={"android.permission.INTERNET", "android.permission.ACCESS_NETWORK_STATE"})

public class AMZNWrapper extends ViewWrapper<AdLayout> {
    private AdLayout adView; // The ad view used to load and display the ad.
    private static final String LOG_TAG = "AMZNWrapper"; // Tag used to prefix all log messages

Thanks any help.



    3.4 KB · Views: 174


Well-Known Member
Licensed User
is amazon-ads in your libs folder?

Thanks. Yep.

The purpose of the @DependsOn attribute within the .java source file is to generate a dependency referencing an external jar within the output XML file?

For example, in my case, the XML file output by the Simple Library Compiler should include the line:


If I manually add this line to the XML file, everybody is happy. The external library is found and the wrapper I am developing works (sort of).

I'm either doing something wrong or the Simple Library Compiler doesn't support this attribute and it's giving me the "unknown symbol" error.

If I look in my current B4A AdLibs directory. Within the Admob.xml file I find the line:

There is also the file GoogleAdMobAdsSdk.jar in this directory.

I don't have the source code for this version of the Admob wrapper, but I'm assuming it has the attribute statement @DependsOn(values={"GoogleAdMobAdsSdk"}) within it. With the "value" being the name of the jar file to reference.

In the examples included with the SLC, Flurry has the statement @DependsOn – so I'm confident the SLC supports this. I don't have all the included jars for the Flurry example, but if I comment out the lines of source code which depend on an external library, it doesn't choke with the "unknown symbol" error at the @DependsOn statement and adds <dependsOn> ... to the output xml.

Last edited:


Well-Known Member
Licensed User
Thanks. The import statement solved the problem.

I think you are right about using Eclipse. I was trying to sneak by with Notepad++. Eclipse has quite a few useful features for development.

I remember seeing a post that mentioned using SLC as a tool from within Eclipse. I will have to search for that.


Well-Known Member
Licensed User


Licensed User
I think I have some problem understanding well the DependsOn statement....

In my case I pretend to compile this code to create my library. I need to import an external .jar file, as you can see in my code.

Can anyone tell me what should I put in the DependsOn?
Thank you a lot!!!!!

package anywheresoftware.b4a.MongoDBClient;

import anywheresoftware.b4a.BA.Permissions;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.*;
import android.telephony.*; 


package app;

import com.mongodb.BasicDBObject;
import com.mongodb.BasicDBList;
import com.mongodb.BulkWriteOperation;
import com.mongodb.BulkWriteResult;
import com.mongodb.Cursor;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import com.mongodb.MongoClient;
import com.mongodb.MongoCredential;
import com.mongodb.ParallelScanOptions;
import com.mongodb.ServerAddress;


import java.util.Arrays;
import java.util.List;
import java.util.Set;

@DependsOn(values={"some java library "})

public class MongoDBClient {
public MongoDBClient()        

public String find(String miCollection,String query) throws UnknownHostException{
                MongoClient mongoClient = new MongoClient( "localhost" , 27017 );
                DB db = mongoClient.getDB( "santander" );
                DBCollection coll = db.getCollection(miCollection);

                Object o = com.mongodb.util.JSON.parse(query);
                DBCursor cursor = coll.find((DBObject) o);
                return cursor.toArray().toString();
  public static void main(String[] args) throws Exception {
   MongoDBClient mc = new MongoDBClient();


Licensed User
well, I need to put only the .jar file...


Best regards