Android Question [SOLVED] already added: Lcom/google/firebase/encoders/

DonManfred

Expert
Licensed User
I´m trying to compile a project using a fresh newlyinstalled sdk as per Instructions.
When opening the project i get an Error

B4A Version: 10.2
Java Version: 11
Parsing code. (0.32s)
Building folders structure. (0.35s)
Compiling code. (0.41s)
Compiling layouts code. (0.08s)
Organizing libraries. Error
Maven artifact not found: androidx.annotation/annotation-experimental
I then ran the SDKManager and install the missing Artifact. I also installed all recommended (and preselected) Items.

SDKManager has the Version 3.71
BTW: The SDKManager inside the B4A 10.2 Setup contains Version 3.70

After the SDKManager has done its Job i refreshed the Librarytab in the IDE with my Project opened.

An Errormessage pops up:
"An Error occured.
Maven Artifact not found: com.google.firebase/firebase-encoders

I then installed the firebase-encoders (V16.0.0) with the SDKManager and refreshed the Librarylist

An Errormessage pops up:
"An Error occured.
Maven Artifact not found: androidx.viewpager2/viewpager2

I then installed the androidx.viewpager2.viewpager2 (V1.0.0) with the SDKManager and refreshed the Librarylist

Now no more Errors appear when refreshing.

I now clean my project and do a recompile:


B4A Version: 10.2
Java Version: 11
Parsing code. (0.29s)
Building folders structure. (0.05s)
Compiling code. (0.36s)
Compiling layouts code. (0.04s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Running custom action. (0.15s)
Generating R file. (1.82s)
Compiling generated Java code. (7.51s)
Convert byte code - optimized dex. Error
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/DataEncoder;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/Encoder;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/EncodingException;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/ObjectEncoder;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/ObjectEncoderContext;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/ValueEncoder;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/ValueEncoderContext;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/annotations/Encodable;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/annotations/Encodable$Field;
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:692)
at com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)
at com.android.dx.command.dexer.Main.runDx(Main.java:291)
at com.android.dx.command.dexer.Main.main(Main.java:249)
at com.android.dx.command.Main.main(Main.java:94)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:684)
... 4 more
Libraries i am using:
Libsused.png


Manifest:
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'CreateResourceFromFile(Macro, Themes.DarkTheme)
SetApplicationAttribute(android:theme, "@style/MyAppTheme")
CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="@style/Theme.AppCompat">
        <item name="colorPrimary">#0098FF</item>
        <item name="colorPrimaryDark">#007CF5</item>
        <item name="colorAccent">#AAAA00</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowDrawsSystemBarBackgrounds">false</item>
        <item name="android:statusBarColor">@android:color/transparent</item>
    </style>
</resources>
)

'End of default text.
' ### FIREBASE
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
CreateResourceFromFile(Macro, FirebaseAnalytics.Crashlytics)
'CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)


AddPermission(android.permission.WRITE_EXTERNAL_STORAGE) ' Allows an application to write to external storage.
AddPermission(android.permission.READ_PHONE_STATE) ' Allows read only access to phone state.
AddPermission(android.permission.CAMERA) ' Required to be able to access the camera device.
AddPermission(android.permission.RECORD_AUDIO) ' Allows an application to record audio.

' ### FILE PROVIDER
AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <files-path name="name" path="shared" />
)

AddReceiverText(AutoStartApp, <intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>)

CreateResourceFromFile(Macro, Core.NetworkClearText)
As i do use Crashlytics in main i do have
B4X:
#Extends: androidx.appcompat.app.AppCompatActivity
#AdditionalJar: com.google.firebase:firebase-crashlytics
Any Hint to fix the PRoblem would be appreciated.
 
Last edited:
Top