Reputation: 83
I'm working on a project where I've to integrate two Android apps into a single app, using Android Studio IDE.
For example, I have App_A and App_B; these two Android apps are from two separate vendors. Now I've to integrate App_B inside App_A. Hence there would be a single AndroidManifest.xml file (of App_A) with MainActivity (launcher) and a single apk would be generated.
So far, I've imported App_B as a module inside App_A. Now, I can run each module separately. But I've to create a single apk file comprising of two modules.
I've searched in different Android forums in the Internet and so far I've not found any suitable solution.
First of all, I want to know whether it's possible to integrate two Android apps from two different vendors into a single Android app. If it's possible then please provide a solution to this issue. Also it would be a great help if you can send me your suggestions, ideas or any links regarding this issue.
Thanks & regards,
Debu
Upvotes: 8
Views: 26956
Reputation: 169
Create a new Android project using Android Studio. Your main app will be the host application where you'll integrate your modules. multiple modules you can create as .arr file Build the .aar Files Build the Library Modules:
Go to Build > Make Project or use the ./gradlew assembleRelease command. The .aar files will be generated in module-name/build/outputs/aar/. Copy the .aar Files:
Copy the generated .aar files to a specific folder in your main libs floder project (e.g., libs).repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
implementation(name: 'mylibrary-release', ext: 'aar') // Replace with your actual library file name
}
Sync the project with Gradle by clicking "Sync Now".
Bui
ld and run your app to ensure the .aar modules are correctly integrated. Notes: If your .aar file has additional dependencies, you need to declare them in the app's build.gradle. To automate .aar generation and integration, consider using CI/CD pipelines or scripts to streamline this process. Use ProGuard rules if needed to prevent code obfuscation issues.
Upvotes: 0
Reputation: 14011
If you just want to integrate App_A and App_B, just as your case, you could do like this: select App_A and right-click
--->Open Module Settings
--->Modules
--->App_A
--->Dependencies
--->Plus
--->Module Dependency
--->select App_B
and then OK
.
But if you want export only one APK
from the two modules
, I am afraid you have to add activity&service&broadcast
thing of AndroidManifest.xml
of App_B
into that of App_A
manully. and delete AndroidManifest.xml
of App_B
.
Upvotes: 1
Reputation: 4656
Yes you can do that:
Modify the dependencies
section of your Main module's build.gradle
file to include the third party module as a dependency like this:
compile project(':your_module_name_here')
Upvotes: 3
Reputation: 870
You can launch other apps activities from your main app. It's the same as integrating facebook, you declare com.facebook.LoginActivity
in your manifest. In Project_A manifest file declare activity from Project_B. FB eg:
<activity
android:hardwareAccelerated="false"
android:name="com.facebook.LoginActivity"
android:theme="@style/Vinted.NoActionBar"
android:screenOrientation="portrait"/>
Also don't forget to include Project_B in gradle, FB eg:
compile('com.facebook.android:facebook-android-sdk:3.23.1')
Upvotes: 1