Android Question Dex Error

brianwiz12

Active Member
Licensed User
Longtime User
Hello,

I searched the form and increased my memory and still getting a dex error

Program Information
305 modules
300 images
300 balances

Increased Dex from 512 to 1524 and it failed with Some error about (cant remember) but searched the forum and dropped it to 1024 and still same below.

I cannot find a debug option to disable in the 5.80 beta version of program

B4X:
B4A version: 5.80 BETA #1
Parsing code.    (0.29s)
Compiling code.    (3.27s)
Compiling layouts code.    (2.01s)
Generating R file.    (0.11s)
Compiling generated Java code.    (18.55s)
Convert byte code - optimized dex.    Error
trouble writing output: Too many field references: 99365; max is 65536.
You may try using --multi-dex option.
References by package:
     5 android.app
     3 android.content.pm
    19 android.graphics
     3 android.os
     4 android.util
     2 android.view
   119 anywheresoftware.b4a
    81 anywheresoftware.b4a.keywords
   125 anywheresoftware.b4a.keywords.constants
   179 anywheresoftware.b4a.objects
    13 anywheresoftware.b4a.objects.collections
    15 anywheresoftware.b4a.objects.drawable
     3 anywheresoftware.b4a.objects.streams
98781 b4a.example
     6 java.lang
     4 java.lang.annotation
     1 java.nio
     1 java.util
     1 java.util.concurrent
 

brianwiz12

Active Member
Licensed User
Longtime User
Interesting Note:

I have 1-10 modules going from numbers 1-30

I load 1-8 without an issue. Once I get to 9 or 10 either one I load is an issue.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

brianwiz12

Active Member
Licensed User
Longtime User
I cannot upload too big so here is the code for each module I use

B4X:
#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: False
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
Dim btnone As Button
Dim edt1 As EditText
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
     Activity.LoadLayout("8x18")
     Activity.SetBackgroundImage(LoadBitmap(File.DirAssets, "background.png"))
     edt1.Color = Colors.White
End Sub

Sub btnone_click
    If edt1.Text = 144 Then
        Msgbox("Correct answer", "Result")
        btnnext_click
    Else
        Msgbox("Wrong answer", "Result")
    End If
End Sub


Sub btnnext_click
    StartActivity("eightnineteen")
    Activity.finish
End Sub

I have so many modules because I want to go through the flow from 1-15/30. I originally had it planned to just do 5 numbers up to 30 then figured to go to 10. That's when I hit the limit at 9.

In the new program I basically cut it in half to accomplish what I wanted so instead of 30 for each number its only 15.
 
Upvote 0

ivan.tellez

Active Member
Licensed User
Longtime User
I have so many modules because I want to go through the flow from 1-15/30. I originally had it planned to just do 5 numbers up to 30 then figured to go to 10. That's when I hit the limit at 9.

WTF??? This can be done with ONE Activity Module and a little code. No need to have tons of different modules.


But, for the solution

https://androidthoughts.wordpress.c...version-to-dalvik-format-failed-with-error-2/
How come there are 90k classes in b4a.example?

I think the error is about 90k methods, not classes.

Anyway check this to solve it:


Dx trouble writing output: Too many fields
 
Upvote 0

brianwiz12

Active Member
Licensed User
Longtime User
Thank you for the feedback as I become a stronger App programmer I look forward to learning how to condense and make apps efficient
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…