'how to call the .aar file activity from parent activity in android studio when a button is clicked in parent app?

I am trying to import the .aar in the parent app, the .aar file contains multiple activities and functions, what I am trying to do here is imported the aar file in the libs folder which is present in the app[directly pasted inside] folder, and then implemented it in build Gradle, but I am getting an android resource link failed.

You can check these images of what I have done in the coding part

this is the error i am getting Error Image

and this is how I called the libs folder

Implemented in gradle

I called the lib folder like this

setting gradle gradle

In the manifest file, I try to call the activity like this

parentmanifist

in the child manifest I commented on the activity tag, it showed duplicate

aar file manifist

can anyone help me to fix this issue, when I click a button in parent activity which is in mainactivity.kt it should go to child activity which is present in aar file, named HomeActivity.

both manifest files manifest

This the new error i am getting

  Process: com.example.myapplication, PID: 9182
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/live.hms.app2.ui.home.HomeActivity}: android.view.InflateException: Binary XML file line #46 in com.example.myapplication:layout/activity_home: Binary XML file line #46 in com.example.myapplication:layout/activity_home: Error inflating class androidx.fragment.app.FragmentContainerView

which is

activity_main



Solution 1:[1]

The aar file has it own manifest file in it. You don't need to decare HomeActivity in the manifest file of app module. Android studio can help you merge all the manifest files into one file.

Just directly use HomeActivity in MainActivity:

Intent intent = new Intent(this, HomeActivity.class);
startActivity(intent);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 simon5678