Android Question [solved] DJI library example : error: resource android:attr/lStar not found

freedom2000

Well-Known Member
Licensed User
Longtime User
Hi all,

I have successfully compiled and run my old DJI code which runs now perfectly well with the new 4.16 DJI library and on my old desktop PC.

I wanted to go on holidays with my B4A compiler so I decided to install it on a Toshiba laptop.
Everything was fine, Compiler works...
But when trying to link the drone Erel's example I get this error:

errorlink:
B4A Version: 11.80
Parsing code.    (0.01s)
    Java Version: 11
Building folders structure.    (0.04s)
Compiling code.    (0.05s)
Compiling layouts code.    (0.02s)
Organizing libraries.    (13.72s)
    (AndroidX SDK)
Compiling resources    (13.18s)
Linking resources    Error
warn: removing resource fr.free.JulienGley.Drone:dimen/offline_map_header_bar_title_size without required default value.
warn: removing resource fr.free.JulienGley.Drone:dimen/offline_map_manager_title_size without required default value.
c:\android\tools\..\extras\b4a_remote\androidx\core\core\1.8.0\unpacked-core-1.8.0\res\values\values.xml:112: error: resource android:attr/lStar not found.
error: failed linking references.


I have tried to uninstall everything and re install following Erel's recommandations. But same problem again and again...
Of course I installed all the dependencies with the sdkManager.
The difference between my desktop and my laptop is that the desktop is much older (32bits W7) and the laptop 64bits W10...


Any help would be appreciated. Thanks
 

freedom2000

Well-Known Member
Licensed User
Longtime User
Yes I am aware of this. But a few dependencies are needed to run the DJI SDK. (see step 4)
I only installed them one by one (compile error after compile error).

DJI lib installation procedure
1. Register with DJI: https://developer.dji.com/ and create an app in the User Center page. You will see an App Key that you need to add to the manifest editor.
The bundle identifier must match your app package name.
2. Add this code to the manifest editor:
B4X:

AddReplacement($DJI_KEY$, XXXXXXXXX)
CreateResourceFromFile(Macro, DJI.DJI)
Replace XXXXXXXXXX with your App key.
3. Add to the main activity code:
B4X:

#BridgeLogger: true
#MultiDex: true
#AdditionalJar: dji-sdk-provided-4.16, ReferenceOnly
#AdditionalJar: kotlin-stdlib-1.5.10

4. You might need to install a few components with B4A Sdk Manager.
5 Initialize the SDK when the application starts. The RegisteredResult event will be raised. If successful then call sdk.StartConnectionToProduct to start a connection.
6. The ProductConnected event will be raised. If AircraftData is not Null then you are good to go and can initialize the DJIAircraft object and the other features (see how it is done in the example).
7 Most of the operations are asynchronous. They are built to work with the Wait For keyword.
8. Expect disconnections and other errors.
9. New: See the Activity_Resume code in the example. It is needed to handle reconnections.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
The difference between my desktop and my laptop is that the desktop is much older (32bits W7) and the laptop 64bits W10...
Your desktop is 32 bits but B4A 11.80 is 64 bits, maybe this is the problem.
 
Upvote 0

freedom2000

Well-Known Member
Licensed User
Longtime User
Yes, but it's working with the 32bits old PC.
And fails with the 64 one ... I don't know where is my mistake !
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
This reference puzzles me.

c:\android\tools\..\extras\b4a_remote\androidx\core\core\1.8.0\unpacked-core-1.8.0\res\values\values.xml:112: error: resource android:attr/lStar not found.

This is a B4A addition to the SDK but the current value in my SDK is 1.3.1 so I wonder where this reference comes from.
 
Upvote 0

freedom2000

Well-Known Member
Licensed User
Longtime User
yes there is one... filled with "values" !

B4X:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <attr format="reference" name="nestedScrollViewStyle"/>
    <color name="androidx_core_ripple_material_light">#1f000000</color>
    <color name="androidx_core_secondary_text_default_material_light">#8a000000</color>
    <color name="notification_action_color_filter">#ffffffff</color>
    <color name="notification_icon_bg_color">#ff9e9e9e</color>
    <dimen name="compat_button_inset_horizontal_material">4dp</dimen>
    <dimen name="compat_button_inset_vertical_material">6dp</dimen>
    <dimen name="compat_button_padding_horizontal_material">8dp</dimen>
    <dimen name="compat_button_padding_vertical_material">4dp</dimen>
    <dimen name="compat_control_corner_material">2dp</dimen>
    <dimen name="compat_notification_large_icon_max_height">320dp</dimen>
    <dimen name="compat_notification_large_icon_max_width">320dp</dimen>
    <dimen name="notification_action_icon_size">32dp</dimen>
    <dimen name="notification_action_text_size">13sp</dimen>
    <dimen name="notification_big_circle_margin">12dp</dimen>
    <dimen name="notification_content_margin_start">8dp</dimen>
    <dimen name="notification_large_icon_height">64dp</dimen>
    <dimen name="notification_large_icon_width">64dp</dimen>
    <dimen name="notification_main_column_padding_top">10dp</dimen>
    <dimen name="notification_media_narrow_margin">@dimen/notification_content_margin_start</dimen>
    <dimen name="notification_right_icon_size">16dp</dimen>
    <dimen name="notification_right_side_padding_top">2dp</dimen>
    <dimen name="notification_small_icon_background_padding">3dp</dimen>
    <dimen name="notification_small_icon_size_as_large">24dp</dimen>
    <dimen name="notification_subtext_size">13sp</dimen>
    <dimen name="notification_top_pad">10dp</dimen>
    <dimen name="notification_top_pad_large_text">5dp</dimen>
    <drawable name="notification_template_icon_bg">#3333B5E5</drawable>
    <drawable name="notification_template_icon_low_bg">#0cffffff</drawable>
    <item name="accessibility_action_clickable_span" type="id"/>
    <item name="accessibility_custom_action_0" type="id"/>
    <item name="accessibility_custom_action_1" type="id"/>
    <item name="accessibility_custom_action_10" type="id"/>
    <item name="accessibility_custom_action_11" type="id"/>
    <item name="accessibility_custom_action_12" type="id"/>
    <item name="accessibility_custom_action_13" type="id"/>
    <item name="accessibility_custom_action_14" type="id"/>
    <item name="accessibility_custom_action_15" type="id"/>
    <item name="accessibility_custom_action_16" type="id"/>
    <item name="accessibility_custom_action_17" type="id"/>
    <item name="accessibility_custom_action_18" type="id"/>
    <item name="accessibility_custom_action_19" type="id"/>
    <item name="accessibility_custom_action_2" type="id"/>
    <item name="accessibility_custom_action_20" type="id"/>
    <item name="accessibility_custom_action_21" type="id"/>
    <item name="accessibility_custom_action_22" type="id"/>
    <item name="accessibility_custom_action_23" type="id"/>
    <item name="accessibility_custom_action_24" type="id"/>
    <item name="accessibility_custom_action_25" type="id"/>
    <item name="accessibility_custom_action_26" type="id"/>
    <item name="accessibility_custom_action_27" type="id"/>
    <item name="accessibility_custom_action_28" type="id"/>
    <item name="accessibility_custom_action_29" type="id"/>
    <item name="accessibility_custom_action_3" type="id"/>
    <item name="accessibility_custom_action_30" type="id"/>
    <item name="accessibility_custom_action_31" type="id"/>
    <item name="accessibility_custom_action_4" type="id"/>
    <item name="accessibility_custom_action_5" type="id"/>
    <item name="accessibility_custom_action_6" type="id"/>
    <item name="accessibility_custom_action_7" type="id"/>
    <item name="accessibility_custom_action_8" type="id"/>
    <item name="accessibility_custom_action_9" type="id"/>
    <item name="line1" type="id"/>
    <item name="line3" type="id"/>
    <item name="tag_accessibility_actions" type="id"/>
    <item name="tag_accessibility_clickable_spans" type="id"/>
    <item name="tag_accessibility_heading" type="id"/>
    <item name="tag_accessibility_pane_title" type="id"/>
    <item name="tag_on_apply_window_listener" type="id"/>
    <item name="tag_on_receive_content_listener" type="id"/>
    <item name="tag_on_receive_content_mime_types" type="id"/>
    <item name="tag_screen_reader_focusable" type="id"/>
    <item name="tag_state_description" type="id"/>
    <item name="tag_transition_group" type="id"/>
    <item name="tag_unhandled_key_event_manager" type="id"/>
    <item name="tag_unhandled_key_listeners" type="id"/>
    <item name="tag_window_insets_animation_callback" type="id"/>
    <item name="text" type="id"/>
    <item name="text2" type="id"/>
    <item name="title" type="id"/>
    <integer name="status_bar_notification_info_maxnum">999</integer>
    <string name="status_bar_notification_info_overflow">999+</string>
    <style name="TextAppearance.Compat.Notification" parent="@android:style/TextAppearance.StatusBar.EventContent"/>
    <style name="TextAppearance.Compat.Notification.Info">
        <item name="android:textSize">12sp</item>
        <item name="android:textColor">?android:attr/textColorSecondary</item>
    </style>
    <style name="TextAppearance.Compat.Notification.Line2" parent="TextAppearance.Compat.Notification.Info"/>
    <style name="TextAppearance.Compat.Notification.Time">
        <item name="android:textSize">12sp</item>
        <item name="android:textColor">?android:attr/textColorSecondary</item>
    </style>
    <style name="TextAppearance.Compat.Notification.Title" parent="@android:style/TextAppearance.StatusBar.EventContent.Title"/>
    <style name="Widget.Compat.NotificationActionContainer" parent=""/>
    <style name="Widget.Compat.NotificationActionText" parent=""/>
    <declare-styleable name="Capability">
        
        <attr format="reference" name="queryPatterns"/>
        
        <attr format="boolean" name="shortcutMatchRequired"/>
    </declare-styleable>
    <declare-styleable name="ColorStateListItem">
        
        <attr name="android:color"/>
        
        <attr format="float" name="alpha"/>
        <attr name="android:alpha"/>
        
        <attr format="float" name="lStar"/>
        <attr name="android:lStar"/>
    </declare-styleable>
    <declare-styleable name="FontFamily">
        
        <attr format="string" name="fontProviderAuthority"/>
        
        <attr format="string" name="fontProviderPackage"/>
        
        <attr format="string" name="fontProviderQuery"/>
        
        <attr format="reference" name="fontProviderCerts"/>
        
        <attr name="fontProviderFetchStrategy">
            <!-- The blocking font fetch works as follows.
              First, check the local cache, then if the requested font is not cached, request the
              font from the provider and wait until it is finished.  You can change the length of
              the timeout by modifying fontProviderFetchTimeout.  If the timeout happens, the
              default typeface will be used instead. -->
            <enum name="blocking" value="0"/>
            <!-- The async font fetch works as follows.
              First, check the local cache, then if the requeted font is not cached, trigger a
              request the font and continue with layout inflation. Once the font fetch succeeds, the
              target text view will be refreshed with the downloaded font data. The
              fontProviderFetchTimeout will be ignored if async loading is specified. -->
            <enum name="async" value="1"/>
        </attr>
        
        <attr format="integer" name="fontProviderFetchTimeout">
            <!-- A special value for the timeout. In this case, the blocking font fetching will not
              timeout and wait until a reply is received from the font provider. -->
            <enum name="forever" value="-1"/>
        </attr>
        
        <attr format="string" name="fontProviderSystemFontFamily"/>
    </declare-styleable>
    <declare-styleable name="FontFamilyFont">
        
        <attr name="fontStyle">
            <enum name="normal" value="0"/>
            <enum name="italic" value="1"/>
        </attr>
        
        <attr format="reference" name="font"/>
        
        <attr format="integer" name="fontWeight"/>
        
        <attr format="string" name="fontVariationSettings"/>
        
        <attr format="integer" name="ttcIndex"/>
        
        <attr name="android:fontStyle"/>
        <attr name="android:font"/>
        <attr name="android:fontWeight"/>
        <attr name="android:fontVariationSettings"/>
        <attr name="android:ttcIndex"/>
    </declare-styleable>
    <declare-styleable name="GradientColor">
        
        <attr name="android:startColor"/>
        
        <attr name="android:centerColor"/>
        
        <attr name="android:endColor"/>
        
        <attr name="android:type"/>

        
        
        <attr name="android:gradientRadius"/>

        
        
        <attr name="android:centerX"/>
        
        <attr name="android:centerY"/>

        
        
        <attr name="android:startX"/>
        
        <attr name="android:startY"/>
        
        <attr name="android:endX"/>
        
        <attr name="android:endY"/>

        
        <attr name="android:tileMode"/>
    </declare-styleable>
    <declare-styleable name="GradientColorItem">
        
        <attr name="android:offset"/>
        
        <attr name="android:color"/>
    </declare-styleable>
</resources>
 
Upvote 0

freedom2000

Well-Known Member
Licensed User
Longtime User
Thanks so much for this link.
So it seems to be a conflict with kotlin (android12).
But I don't know yet how to fix it in b4a !
 
Upvote 0

freedom2000

Well-Known Member
Licensed User
Longtime User
Ok I have tried a full new installation.
- deleted Android SDK
- uninstalled B4A
- deleted Additionnal_libraries folder

installed B4A and the two zip following these instructions : https://www.b4x.com/b4a.html

the paths are Ok
BA4 is running

Now I have downloaded DJI libraries and followed these insttructions:
https://www.b4x.com/android/files/dji_additional.zip installed into the additionnal_libraires folder
https://www.b4x.com/android/forum/attachments/dji-zip.126786/ installed into the additionnal_libraires folder

Now I tried to compile DJIexample code
and I got the following errors:

B4X:
Organizing libraries.    Error
Maven artifact not found: androidx.lifecycle/lifecycle-process
Source: DJI

then I updated Android sdk with all the files related to "androidx.lifecycle" --> 19 components

I tried to compile again and got this error
B4X:
Organizing libraries.    Error
Maven artifact not found: androidx.core/core-ktx
Source: RuntimePermissions

I installed "androidx.core" 11 components

Then compiled again and got this error
B4X:
Organizing libraries.    Error
Maven artifact not found: androidx.annotation/annotation-experimental
Source: RuntimePermissions

I installed "androidx.annotation" 3 components

I got this error
B4X:
Organizing libraries.    Error
Maven artifact not found: androidx.startup/startup-runtime
Source: DJI

I installed "androidx.startup" 1 component

Then compilation is Ok but link fails

B4X:
B4A Version: 11.80
Parsing code.    (0.02s)
    Java Version: 11
Building folders structure.    (0.03s)
Compiling code.    (0.12s)
Compiling layouts code.    (0.00s)
Organizing libraries.    (5.78s)
    (AndroidX SDK)
Compiling resources    (9.19s)
Linking resources    Error
warn: removing resource fr.free.JulienGley.Drone:dimen/offline_map_header_bar_title_size without required default value.
warn: removing resource fr.free.JulienGley.Drone:dimen/offline_map_manager_title_size without required default value.
c:\android\tools\..\extras\b4a_remote\androidx\core\core\1.8.0\unpacked-core-1.8.0\res\values\values.xml:112: error: resource android:attr/lStar not found.
error: failed linking references.

At least I can reproduce easily this bug :)

Thanks for your help
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I just started with a fresh SDK and was able to compile.

You need to be careful when working with B4A Sdk Manager. It will try to install all recommended resources and you will end up with versions that do not compile.

You need to install exactly three items:
androidx.lifecycle:lifecycle-process
androidx.startup:startup-runtime
androidx.lifecycle:lifecycle-service

Make sure to click on the "Deselect All" button every time or it will install all "recommended items".
 
Upvote 0

freedom2000

Well-Known Member
Licensed User
Longtime User
I did exactly as you recommended and .... IT WORKS !!!

B4X:
B4A Version: 11.80
Parsing code.    (0.02s)
    Java Version: 11
Building folders structure.    (0.04s)
Compiling code.    (0.04s)
Compiling layouts code.    (0.00s)
Organizing libraries.    (13.86s)
    (AndroidX SDK)
Compiling resources    (6.84s)
Linking resources    (23.32s)
Compiling debugger engine code.    (5.03s)
Compiling generated Java code.    (10.85s)
Finding libraries that need to be dexed.    (0.21s)
Dex: B4AShared    (5.84s)
Dex: Debug    (3.28s)
Dex: C:\Android\tools\..\extras\b4a_local\unpacked-dji-sdk-4.16-63780420037517\jars\adapter-rxjava2-2.2.0    (1.79s)
Dex: C:\Android\tools\..\extras\b4a_local\unpacked-dji-sdk-4.16-63780420037517
...

The most important thing was :
You need to install exactly three items:
androidx.lifecycle:lifecycle-process
androidx.startup:startup-runtime
androidx.lifecycle:lifecycle-service

My mistake was to install all the "androidx.lifecycle" components...

Once again thank you for your help
 
Upvote 0
Top