Android Question Simple Library Compiler and webrtc

Addo

Well-Known Member
Licensed User
Longtime User
I am trying to wrap a WebRTC based library when ever i try to compile the java classes I got this error

Starting step: Compiling Java code.
C:\Users\fredy\Desktop\libraries\SimpleRtc\src\com\fredy\webrtc\simplertc.java:94: error: static interface method invocations are not supported in -source 7
eglBaseContext = EglBase.create().getEglBaseContext();
^
(use -source 8 or higher to enable static interface method invocations)
1 error

javac 11.0.1

Error.
how can i use source 8 with SLC ?
 
Solution
Erel has been going to fix this for literally years but hasn't so far.
There are no immediate plans to make SLC support Java 11. This requires a complete rewrite of the doclet tool and I don't find it to be too limiting to require Java 8 to be installed when using SLC. I actually did create a new version of the doclet tool for B4J that supports Java 11 but it doesn't support all features.

V1.12 released with target and source set to Java 8: https://www.b4x.com/android/forum/t...uild-libraries-without-eclipse.29918/#content

agraham

Expert
Licensed User
Longtime User
I don't think you can. Poking around inside LibraryCompiler.exe it explicitly invokes -source 1.7 (synonym for 7) for compilation.
C#:
    string[] textArray1 = new string[] { @"-d bin\classes", Form1.b4j ? " " : (" -bootclasspath " + ProcessHelper.q(ProcessHelper.androidjar) + " -target 1.7 -source 1.7"), " -Xmaxerrs 1 -Xlint:none -J-Xmx512m  -version -encoding UTF-8 -sourcepath src -cp ", createClassPath(), " ", createJavaFiles() };
    p.StartInfo.Arguments = string.Concat(textArray1);
    ProcessHelper.ProcessResult result = ProcessHelper.runProcess(p, true);
    result.error = result.error + "\r\n" + result.output;
    return result;
Probably needs a mod to SLC or an edit to your source to not use static interface methods.
 
Upvote 0

Addo

Well-Known Member
Licensed User
Longtime User
I don't think you can. Poking around inside LibraryCompiler.exe it explicitly invokes -source 1.7 (synonym for 7) for compilation.
C#:
    string[] textArray1 = new string[] { @"-d bin\classes", Form1.b4j ? " " : (" -bootclasspath " + ProcessHelper.q(ProcessHelper.androidjar) + " -target 1.7 -source 1.7"), " -Xmaxerrs 1 -Xlint:none -J-Xmx512m  -version -encoding UTF-8 -sourcepath src -cp ", createClassPath(), " ", createJavaFiles() };
    p.StartInfo.Arguments = string.Concat(textArray1);
    ProcessHelper.ProcessResult result = ProcessHelper.runProcess(p, true);
    result.error = result.error + "\r\n" + result.output;
    return result;
Probably needs a mod to SLC or an edit to your source to not use static interface methods.
Modification of webrtc library can lead to many errors to the library itself hopefully we can find a different solution
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
hopefully we can find a different solution
Not with SLC unless it is modified.by Erel.

Also I note that you seem to be using Java 11. BADoclet does not always work correctly under Java 11 producing invalid xml files.. It only works correctly under Java 8. Erel has been going to fix this for literally years but hasn't so far.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Erel has been going to fix this for literally years but hasn't so far.
There are no immediate plans to make SLC support Java 11. This requires a complete rewrite of the doclet tool and I don't find it to be too limiting to require Java 8 to be installed when using SLC. I actually did create a new version of the doclet tool for B4J that supports Java 11 but it doesn't support all features.

V1.12 released with target and source set to Java 8: https://www.b4x.com/android/forum/t...uild-libraries-without-eclipse.29918/#content
 
Upvote 0
Solution

Addo

Well-Known Member
Licensed User
Longtime User
There are no immediate plans to make SLC support Java 11. This requires a complete rewrite of the doclet tool and I don't find it to be too limiting to require Java 8 to be installed when using SLC. I actually did create a new version of the doclet tool for B4J that supports Java 11 but it doesn't support all features.

V1.12 released with target and source set to Java 8: https://www.b4x.com/android/forum/t...uild-libraries-without-eclipse.29918/#content
hey Erel i have tried the new version i encountered in this error

C:\Users\fredy\Desktop\libraries\simplertc\src\com\fredy\januswebrtc\simplertc.java:17: error: package org.json does not exist
import org.json.JSONArray;
^
C:\Users\fredy\Desktop\libraries\simplertc\src\com\fredy\januswebrtc\simplertc.java:18: error: package org.json does not exist
import org.json.JSONException;
^
C:\Users\fredy\Desktop\libraries\simplertc\src\com\fredy\januswebrtc\simplertc.java:19: error: package org.json does not exist
import org.json.JSONObject;
^
C:\Users\fredy\Desktop\libraries\simplertc\src\com\fredy\januswebrtc\janus\JanusClient.java:3: error: package android.util does not exist
import android.util.Log;
warning: unknown enum constant DeprecationLevel.ERROR
reason: class file for kotlin.DeprecationLevel not found
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR
warning: unknown enum constant DeprecationLevel.ERROR

should I reconsider something in the new SLC ?
 
Upvote 0

Addo

Well-Known Member
Licensed User
Longtime User
Strange. The json classes are part of Android SDK. Are you sure that you are running the Android SLC and not the B4J one?
Hey Erel I am using android slc, I had to install oracle jdk 8 in order to get my library compiled and more strange after I have compiled with jdk 8, I am able to compile the library with jdk 11 but it's solved now thank you so much for your help and efforts
 
Upvote 0
Top