I am running into a problem that I don't quite understand. I have an .aar file that I am building locally it is included into my main app as such:
// main app gradle
compile 'com.mycompany.mysdk:mysdk@aar'
The aar file has an activity and some widgets as below
// This code is inside the aar file (built locally)
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fatal_error);
mLoadingIndicator = findViewById(R.id.loading_indicator);
if (mLoadingIndicator != null) {
mLoadingIndicator.setVisibility(View.GONE);
}
Yet, when I run the app, my 'mLoadingIndicator' is always null. The R.layout.activity_fatal_error is valid but no widgets inside are found. The widget definitely exists and here is a snipped of the widget I am trying to fetch.
// activity_fatal_error.xml
// This id definitely exists
<ProgressBar
android:id="@+id/loading_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"/>
My issue looks exactly like the issued mentioned below:
Can't find resource identifiers from AAR in XML
but whether I spell out or not the resource Id, it never finds it. Therefore my 'mLoadingIndicator' is always null.
I tried:
mLoadingIndicator = findViewById(com.mycompany.mysdk.R.id.loading_indicator);
// mLoadingIndicator is still null
if (mLoadingIndicator != null) {
mLoadingIndicator.setVisibility(View.GONE);
}
Anyone pointers is greatly appreciated.