Java Question comlibrary problems with R-file

DonManfred

Expert
Licensed User
Longtime User
i move to this forum to discuss the problem with the library @Alberto Iglesias want to wrap to this forum to discuss it here

this port is crucial to library can listen this udp port and used by class
CEACommunicationsLibraryAPIManager

in this line:

final String sport = context.getString(R.string.cea_lib_broadcast_listen_port);

Found it. Ok, the library imports a
import es.cea.comlibrary.R.string;

so i would set the package to the name like in this import.

B4X:
package es.cea.comlibrary;

import anywheresoftware.b4a.BA;

public class R {
    public static final class string {
        public static int cea_lib_broadcast_listen_port = BA.applicationContext.getResources().getIdentifier("cea_lib_broadcast_listen_port", "string", BA.packageName);
        public static int cea_lib_blacklist_port = BA.applicationContext.getResources().getIdentifier("cea_lib_blacklist_port", "string", BA.packageName);
        public static int cea_lib_broadcast_listen_timeout = BA.applicationContext.getResources().getIdentifier("cea_lib_broadcast_listen_timeout", "string", BA.packageName);
        public static int cea_lib_uri_scheme = BA.applicationContext.getResources().getIdentifier("cea_lib_uri_scheme", "string", BA.packageName);
        public static int cea_lib_platform = BA.applicationContext.getResources().getIdentifier("cea_lib_platform", "string", BA.packageName);
        public static int cea_lib_service_version = BA.applicationContext.getResources().getIdentifier("cea_lib_service_version", "string", BA.packageName);
        public static int cea_lib_last_updated = BA.applicationContext.getResources().getIdentifier("cea_lib_last_updated", "string", BA.packageName);
    }
}
and place the r.java in

es\cea\comlibrary\r.java


I´ll send you a mail in return with the lib and src as i dont know it should be public her.

Let us talk here about the wrap then further....
 

DonManfred

Expert
Licensed User
Longtime User
i changed the permissions as i got a error about missing permission.

B4X:
@Permissions(values={"android.permission.ACCESS_WIFI_STATE","android.permission.INTERNET","android.permission.BLUETOOTH"})
Now the sample compiled fine but does not do anything? I guess calling "create" is just a part of what needs to be done
 

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
I´m doing something wrong when compiling.....

Now I got this error in B4A sample:

B4A version: 5.80
Parsing code. (0.00s)
Compiling code. (0.04s)
Compiling layouts code. (0.00s)
Generating R file. (0.09s)
Compiling generated Java code. Error
javac 1.7.0_65
src\com\visualnet\ceasample\main.java:312: error: cannot find symbol
public static com.visualnet.cea.cea _objcea = null;
^
symbol: class cea
location: class cea
Note: src\com\visualnet\ceasample\starter.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error




I ´m compiling with SLC with this command line:
"C:\Users\Iglesias\Source Code\Android\Library\LibraryCompiler.exe" CEA "C:\Users\Iglesias\Source Code\Android\Library\Citroen\CEA"

My structure is the same your´s!

cealib.jpg


With your .jar and .xml works without problems
 

DonManfred

Expert
Licensed User
Longtime User
I´m doing something wrong when compiling.....
See my dropboxlink again. i´ve uploaded the complete eclipseproject-folder i am using.

Maybe you need to change your b4aignore setting in SLC.

What is the output of the SLC log when you compile the library?
 

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
the log of SLC:

B4X:
C:\Users\Iglesias\Source Code\Android\Library\Citroen\CEA>"C:\Users\Iglesias\Source Code\Android\Library\LibraryCompiler.exe" CEA "C:\Users\Iglesias\S
ource Code\Android\Library\Citroen\CEA"
Simple Library Compiler
Starting step: Compiling Java code.
Completed successfully.
Starting step: Creating jar file.
Completed successfully.
Starting step: Creating XML file.
Loading source file C:\Users\Iglesias\Source Code\Android\Library\Citroen\CEA\src\com\visualnet\cea\cea.java...
Loading source file C:\Users\Iglesias\Source Code\Android\Library\Citroen\CEA\src\es\cea\comlibrary\R.java...
Constructing Javadoc information...
[-doclet, BADoclet]
[-docletpath, C:\Users\Iglesias\Source Code\Android\Library]
[-bootclasspath, C:\Android\platforms\android-22\android.jar]
[-classpath, C:\Program Files\Anywhere Software\Basic4android 5.8\B4A.exe\../libraries\B4AShared.jar;C:\Program Files\Anywhere Software\Basic4android
5.8\B4A.exe\../libraries\Core.jar;C:\Users\Iglesias\Source Code\Android\Library\Citroen\CEA\libs\ceasdk.jar;]
[-sourcepath, src]
[-b4atarget, C:\Program Files\Anywhere Software\Basic4android\Libraries2\CEA.xml]
[-b4aignore, org,com.android,com.example,com.hoho]
Ignoring: [org, com.android, com.example, com.hoho]
starting....
Working with class: com.visualnet.cea.cea
Working with class: es.cea.comlibrary.R
No ShortName annotation found for class: R
Working with class: es.cea.comlibrary.R.string
No ShortName annotation found for class: R.string
finish: C:\Program Files\Anywhere Software\Basic4android\Libraries2\CEA.xml
Completed successfully.
*** Don't forget to refresh the libraries list in the IDE (right click and choose Refresh) ***

I will download again...
 

DonManfred

Expert
Licensed User
Longtime User
[-b4aignore, org,com.android,com.example,com.hoho]
i suggest to add
B4X:
es.cea
to the list.

Edit: btw your b4aignore list is sweet ;-)

My is "a little bit more complex". :D
[-b4aignore, net.opacapp,com.sunfusheng,com.mikepenz,com.tarek360,uk.co,com.nightonke,ayar.oktay,com.devbrackets,com.kpbird,com.guardanis,com.afollestad,com.cooltechworks,cx.hell,fr.tvbarthel,com.gigamole,com.meetic,net.glxn,com.beardedhen,com.pnikosis,cn.pedant,com.onlylemi,com.theartofdev,me.sudar,org.greenrobot,com.edwardvanraak,com.google,me.angrybyte,com.amnix,com.itseasy,com.tyorikan,com.nightonke,com.azimolabs,com.guardanis,com.daimajia,net.majorkernelpanic,com.joanzapata,com.wada,com.github,com.google,com.appyvet,com.nbsp,com.wang,io.techery,com.hannesdorfmann,com.actinarium,it.sephiroth,cn.iwgang,su.levenetc,snow.skittles,cn.aigestudio,com.example,com.joooonho,io.codetail,com.serchinastico,com.phillipcalvin,com.tyczj,com.takwolf,com.rockerhieu,org.angmarch,com.zenkun,com.alamkanak,com.github.gcacace,com.dd,com.andexert,com.zenkun,com.googlecode,com.wt,net.sf,com.sun.pdfview,androswing.tree,com.todddavies.components.progressbar.ProgressWheel,com.larvalabs,com.ninja,com.lid,org.sufficientlysecure,com.div.FancyButton,com.skd,com.cesards,com.github.glomadrian,com.erz,com.hipmob,com.larswerkman,com.kristijandraca,net.yscs,me.alexrs,com.github.premnirmal,com.tyczj,com.leaking,com.mustafaferhan,mirko.android,com.johan,fr.castorflex,me.philio,com.fmsirvent,com.daimajia,com.edmodo,com.basv,com.appyvet,com.filippudak,com.eftimoff,org.adw,de.donmanfred.FaceMask,com.joanzapata,org.vudroid,de.donmanfred.SimpleListAdapter,com.timtak,net.simonvt,com.prolificinteractive,anywheresoftware.b4a,com.orangegangsters,com.example,com.inkoniq,com.oguzdev,com.zhy,com.ppi,com.demax,tr.xip,com.meyerlaurent,com.zj,net.frakbot,org.seniorzhai,com.github,com.jpardogo,com.jpardogo,com.jiahuan,com.github,com.appeaser,com.rey,lecho.lib,com.golshadi,com.judopay,com.wangjie,com.yalantis,com.bumptech,me.iwf,tyrantgit,com.ocman,com.tv,com.negusoft,com.vijay,com.rengwuxian,haibison.android,org.mobiledeeplinking,org.jsoup]
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
I can´t see my mistake.... :-(
Im sorry. But it seems we are using Eclipse in another way.

instead of simple loading my project you should have used the importfunction in eclipse.
This is what i do everytime.

In your projectworkspace you rightclick and use the import wizard to "import an existing project to my workspace"... after adding the path of the project folder (CEA) i would import the one project found... Now i have a project CEA in eclipse i work with...

I think the project file in all my libs will have ViewBadger as my start for every lib is a copy of this folder...

I use Eclipse ONLY for help with the syntax and so on. I do not create something with eclipse like you in your video. Honestly i do not know what you are doing there. Never did it before

I only use SLC to compile. BUT from within eclipse....

externaltools0008.png


externaltools0009.png


And when i want to compile the lib i use the runexternaltools function in eclipse....

externaltools0010.png





Maybe it´s me who is using eclipse the wrong way ;-)
 

DonManfred

Expert
Licensed User
Longtime User
you set a project directly for each tool. This works too i guess.
I am using one tool to compile every project...

externaltools0011.png


so in this case i want to compile the project MaterialDialogs (more the folder MaterialDialogs)

it results in

Simple Library Compiler
Starting step: Compiling Java code.
Completed successfully.
Starting step: Creating jar file.
Completed successfully.
Starting step: Creating XML file.
Loading source file E:\EclipseWorkspace.b4alibs\MaterialDialogs\src\de\donmanfred\ColorChooserDialogBuilder.java...
Loading source file E:\EclipseWorkspace.b4alibs\MaterialDialogs\src\de\donmanfred\FileChooserDialogBuilder.java...
Loading source file E:\EclipseWorkspace.b4alibs\MaterialDialogs\src\de\donmanfred\FolderChooserDialogBuilder.java...
Loading source file E:\EclipseWorkspace.b4alibs\MaterialDialogs\src\de\donmanfred\MaterialDialogBuilder.java...
Constructing Javadoc information...
[-doclet, BADoclet]
[-docletpath, E:\Basic4android3\Tools\SimpleLibraryCompiler]
[-doclet, BADoclet]
[-docletpath, E:\Basic4android3\Tools\SimpleLibraryCompiler]
[-bootclasspath, E:\Android\android-sdk\platforms\android-23\android.jar]
[-classpath, E:\Basic4android3\B4A.exe\../libraries\B4AShared.jar;E:\Basic4android3\B4A.exe\../libraries\Core.jar;E:\EclipseWorkspace.b4alibs\\MaterialDialogs\libs\android-support-v4.jar;E:\EclipseWorkspace.b4alibs\\MaterialDialogs\libs\android-support-v7-appcompat.jar;E:\EclipseWorkspace.b4alibs\\MaterialDialogs\libs\commons-0.8.5.9-sources.jar;E:\EclipseWorkspace.b4alibs\\MaterialDialogs\libs\commons.jar;E:\EclipseWorkspace.b4alibs\\MaterialDialogs\libs\core.jar;]
[-sourcepath, src]
[-b4atarget, E:\Basic4android3\AdditionalLibraries\MaterialDialogs.xml]
[-b4aignore, net.opacapp,com.sunfusheng,com.mikepenz,com.tarek360,uk.co,com.nightonke,ayar.oktay,com.devbrackets,com.kpbird,com.guardanis,com.afollestad,com.cooltechworks,cx.hell,fr.tvbarthel,com.gigamole,com.meetic,net.glxn,com.beardedhen,com.pnikosis,cn.pedant,com.onlylemi,com.theartofdev,me.sudar,org.greenrobot,com.edwardvanraak,com.google,me.angrybyte,com.amnix,com.itseasy,com.tyorikan,com.nightonke,com.azimolabs,com.guardanis,com.daimajia,net.majorkernelpanic,com.joanzapata,com.wada,com.github,com.google,com.appyvet,com.nbsp,com.wang,io.techery,com.hannesdorfmann,com.actinarium,it.sephiroth,cn.iwgang,su.levenetc,snow.skittles,cn.aigestudio,com.example,com.joooonho,io.codetail,com.serchinastico,com.phillipcalvin,com.tyczj,com.takwolf,com.rockerhieu,org.angmarch,com.zenkun,com.alamkanak,com.github.gcacace,com.dd,com.andexert,com.zenkun,com.googlecode,com.wt,de.donmanfred.viewbadger,net.sf,com.sun.pdfview,androswing.tree,com.todddavies.components.progressbar.ProgressWheel,com.larvalabs,com.ninja,com.lid,org.sufficientlysecure,com.div.FancyButton,com.skd,com.cesards,com.github.glomadrian,com.erz,com.hipmob,com.larswerkman,com.kristijandraca,net.yscs,me.alexrs,com.github.premnirmal,com.tyczj,com.leaking,com.mustafaferhan,mirko.android,com.johan,fr.castorflex,me.philio,com.fmsirvent,com.daimajia,com.edmodo,com.basv,com.appyvet,com.filippudak,com.eftimoff,org.adw,de.donmanfred.FaceMask,com.joanzapata,org.vudroid,de.donmanfred.SimpleListAdapter,com.timtak,net.simonvt,com.prolificinteractive,anywheresoftware.b4a,com.orangegangsters,com.example,com.inkoniq,com.oguzdev,com.zhy,com.ppi,com.demax,tr.xip,com.meyerlaurent,com.zj,net.frakbot,org.seniorzhai,com.github,com.jpardogo,com.jpardogo,com.jiahuan,com.github,com.appeaser,com.rey,lecho.lib,com.golshadi,com.judopay,com.wangjie,com.yalantis,com.bumptech,me.iwf,tyrantgit,com.ocman,com.tv,com.negusoft,com.vijay,com.rengwuxian,haibison.android,org.mobiledeeplinking,org.jsoup]
Ignoring: [net.opacapp, com.sunfusheng, com.mikepenz, com.tarek360, uk.co, com.nightonke, ayar.oktay, com.devbrackets, com.kpbird, com.guardanis, com.afollestad, com.cooltechworks, cx.hell, fr.tvbarthel, com.gigamole, com.meetic, net.glxn, com.beardedhen, com.pnikosis, cn.pedant, com.onlylemi, com.theartofdev, me.sudar, org.greenrobot, com.edwardvanraak, com.google, me.angrybyte, com.amnix, com.itseasy, com.tyorikan, com.nightonke, com.azimolabs, com.guardanis, com.daimajia, net.majorkernelpanic, com.joanzapata, com.wada, com.github, com.google, com.appyvet, com.nbsp, com.wang, io.techery, com.hannesdorfmann, com.actinarium, it.sephiroth, cn.iwgang, su.levenetc, snow.skittles, cn.aigestudio, com.example, com.joooonho, io.codetail, com.serchinastico, com.phillipcalvin, com.tyczj, com.takwolf, com.rockerhieu, org.angmarch, com.zenkun, com.alamkanak, com.github.gcacace, com.dd, com.andexert, com.zenkun, com.googlecode, com.wt, de.donmanfred.viewbadger, net.sf, com.sun.pdfview, androswing.tree, com.todddavies.components.progressbar.ProgressWheel, com.larvalabs, com.ninja, com.lid, org.sufficientlysecure, com.div.FancyButton, com.skd, com.cesards, com.github.glomadrian, com.erz, com.hipmob, com.larswerkman, com.kristijandraca, net.yscs, me.alexrs, com.github.premnirmal, com.tyczj, com.leaking, com.mustafaferhan, mirko.android, com.johan, fr.castorflex, me.philio, com.fmsirvent, com.daimajia, com.edmodo, com.basv, com.appyvet, com.filippudak, com.eftimoff, org.adw, de.donmanfred.FaceMask, com.joanzapata, org.vudroid, de.donmanfred.SimpleListAdapter, com.timtak, net.simonvt, com.prolificinteractive, anywheresoftware.b4a, com.orangegangsters, com.example, com.inkoniq, com.oguzdev, com.zhy, com.ppi, com.demax, tr.xip, com.meyerlaurent, com.zj, net.frakbot, org.seniorzhai, com.github, com.jpardogo, com.jpardogo, com.jiahuan, com.github, com.appeaser, com.rey, lecho.lib, com.golshadi, com.judopay, com.wangjie, com.yalantis, com.bumptech, me.iwf, tyrantgit, com.ocman, com.tv, com.negusoft, com.vijay, com.rengwuxian, haibison.android, org.mobiledeeplinking, org.jsoup]
starting....
Working with class: de.donmanfred.ColorChooserDialogBuilder
Working with class: de.donmanfred.FileChooserDialogBuilder
Working with class: de.donmanfred.FolderChooserDialogBuilder
Working with class: de.donmanfred.MaterialDialogBuilder
finish: E:\Basic4android3\AdditionalLibraries\MaterialDialogs.xml

Completed successfully.
*** Don't forget to refresh the libraries list in the IDE (right click and choose Refresh) ***

So, in the end i only need one Tool. No matter if i want to compile MaterialDialogs or MaterialDrawer or any other... I just select the one i want to compile and then i click on the Button to run the Tool "SLC"....


I do this way too
But then i do not understand what you did in Eclipse... Creating a Javadoc for the lib...
SLC will do it for you while compiling...
 
Top