Android Studio library “error: package does not exist”

前端 未结 5 1871
轮回少年
轮回少年 2020-12-10 00:30

I have created Android library as Android Studio module. Added as dependency to my root module. While coding I can import any class from library package but while I\'m tryin

5条回答
  •  北海茫月
    2020-12-10 01:08

    For Android Studio 2.2.2

    Yes, in library module, it can't use the apply plugin: com.android.application statement in the module definition, yes, use apply plugin: com.android.library instead. (still in lib module)

    But then you have to do the following:

    1. Expose the same SDK versions in Gradle files for both modules.
    2. Right click on your projects "app" module folder and click on -> open module settings
    3. Click on the "dependencies" tab
    4. Click on the + sign to add a new dependency and select "Module Dependency"
    5. Look for the library you need and add it.

    Also while naming your lib module avoid capitals.

提交回复
热议问题