• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

How to add other file into android build

mag

Active member
3rd Party Module Dev
3rd Party Tool Dev
Joined
Mar 5, 2018
Messages
261
I see the implimentation of admob in admob.cxs file:
Code:
#LIBS+="${CD}/native/GoogleMobileAds.framework"

I don't fully understand what the command LIBS do. I guess it add the file GoogleMobileAds.framework into build. But I wonder where should command LIBS add the file into. The command just give source location but where do it destination at?

Is there any other command we can use to add file into build. For example if I want to add some.java file into this location: "..build\android\app\src\main\java\my\other\package\some.java".

How do I do that in code?
 
The libs prepocessor statememt tells Android studio to link to that standard library.
To add native files, the import statement does just that. Admob does this.
 
Sometime, when i creating a modules, I need to add other packages which should be put on it own package structure like:
se.simbio.encryption below:

addfile.jpg


Can I copy those files and folders (trees) into ..main/java/com/*.* folder by code? Is it possible
 
Sorry for taking so long to answer. The #SRCS directive can do that.

For an example, this:

Cerberus:
#SRCS+="${CD}/native/android_iab/src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl;"

Copies this:

1653817743784.png


Into the build folder at

1653817797374.png


Hope it helps
 
  • Like
Reactions: mag
The code responsible to copy this in the android builder of Trans is the following:

Cerberus:
        'copy src files
        For Local src:=Eachin GetConfigVar( "SRCS" ).Split( ";" )
            Select ExtractExt( src )
            Case "java","aidl"
                Local i:=src.FindLast( "/src/" )
                If i<>-1
                    Local dst:=src[i+1..]
                    If CreateDirRecursive( ExtractDir( "app/"+dst ) )
                        CopyFile src,"app/"+dst
                    Endif
                Endif
            Case "xml"
                Local i:=src.FindLast( "/src/" )
                If i<>-1
                    Local dst:=src[i+1..]
                    If CreateDirRecursive( ExtractDir( "app/"+dst ) )
                        Local str:=LoadString( src )
                        str=ReplaceEnv( str )
                        SaveString str,"app/"+dst
                    Endif
                Endif
            End
        Next

So you can see it only copies files with the ending java, xml or aidl. The destination is everything after the /src/ string in the statement and placed inside the app folder.
 
  • Love
Reactions: mag
Thank you so much. This really clear things up.

So you can see it only copies files with the ending java, xml or aidl
Look like only 3 file types. Sometimes we need other filetypes like json (for example google-service) and sometimes a folder. I can see that the extension is used to determine the target location.

suggestion: I think we can do something to trans to be able to copy something else or a folder like this:

Cerberus:
#SRCS+="${CD}/native/bla/src/bla1/bla2/*;"
will copy all files in src dir into this dir: build/android/bla1/bla2/*

This is the draft trans code:
Cerberus:
            Case "*"
                Local i:=src.FindLast( "/src/" )
                If i<>-1
                    Local dst:=src[i+1..]
                    If CreateDirRecursive( ExtractDir( dst ) )
                        CopyDirContent str,dst
                    Endif
                Endif
            End
 
Back
Top Bottom