1

I am doing android custom ROM development. the app need an aar , reference aar support in Android.mk , I edit Android.mk then use 'mm -B' to build the app successfully.

But it Force Close when run the apk, which packageName is com.demo.android. Caused by: java.lang.ClassNotFoundException: Didn't find class "com.demo.aar.R"

"com.demo.aar" is the packageName for aar/library.

"com.demo.android" is the packageName for app.

I use the aar on AndroidStudio 1.5, the demo app run successfully.

then I compare the apk between android-studio and android.mk.

finally, I find that the apk built with Android.mk has no 'com.demo.aar.R' class, which apk built with AndroidStudio has. (they both has 'com.demo.android.R' class.)

so is this bug of Android.mk , OR I need more config in Android.mk??

4

1 回答 1

0

The solution is use: LOCAL_AAPT_FLAGS += --extra-packages {aar package name}. You will get two R file. They has the some content. One's package is the main package, the other is the aar package.

于 2016-04-18T08:20:00.807 回答