Java Question Third-party VPN library import error

laomms

Member
Licensed User
Longtime User
Finally, I finished it.
I have post the source in https://github.com/laomms/WrapperSample

here is some tips for common errors:

1 ...\additionalres\layout\xxx.xml:9: error: No resource identifier found for attribute 'layout_xxx' in package 'b4a.example.xxx'
reason:missing resource for some dependon library.
solution:eek:pen this xxx.xml in notepad++, check which dependon in the line 9, copy the depend on xxx.aar and xxx.jar to libs folder inside SLC project.
add the the "xxx.aar" name to @DependsOn in b4a wrapper class, recmopile the libaraly.
if the dependon libraly can find only xxx.jar, should copy the res for this library to b4x project, and add res to AdditionalRes in b4x project.

2.android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class androidx.constraintlayout.widget.ConstraintLayout
reason:the name of dependon in wrapper class diffrent with implementation name of dependencies in build.gradle for original java project.
solution: for example in original project there is:
implementation 'com.github.zcweng:switch-button:0.0.3@aar'
in wrapper class should be:
@DependsOn(values={"switch-button-0.0.3.aar","com.github.zcweng:switch-button:0.0.3@aar"} )
the xxx.aar is dependon package file name that you shoud place to additional libraries folder, the second is implementation name.
you can check compiled b4x library xml file,it will show:<dependsOn>switch-button-0.0.3.aar</dependsOn>

3. ..\additionalres\values\styles.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'Base.Theme.AppCompat.Light'.
reason:missing appcompat sdk: androidx.appcompat:appcompat or android.support.v7.app.AppCompatActivity
solution: if is androidx project, in b4a menu, select tool-sdk manager, search appcompat, install the missing sdk and jetifier it.
in the b4x project, add #AdditionalJar: androidx.appcompat:appcompat

4. AndroidManifest.xml:20: error: Error: No resource found that matches the given name (at 'theme' with value '@style/AppTheme').
reason: missing original theme or style xml.
solution:copy original java project source folder to b4x project folder and add res to AdditionalRes in b4x project.

5. D:\android\tools\..\extras\b4a_local\unpacked-constraintlayout-2.0.4-63741602750389\res\values\values.xml:339: error: Attribute "android:alpha" has already been defined
reason: some resource in dependon aar pakage duplacate the sdk that b4a download from sdk manager.
solution open D:\android\extras\b4a_local\unpacked-constraintlayout-2.0.4-63741602750389\res\values\values.xml in notepad++, delete or comment out those confilict lines.
 
Last edited:
Top