How to import android project as library and NOT compile it as apk (Android studio 1.0)
In projLib's build.gradle file, you'll see a statement like this:
apply plugin: 'com.android.application'
which tells Gradle to build it as an application, generating an APK. If you change it to this:
apply plugin: 'com.android.library'
it will build as a library, generating an AAR, and it should work.
If you also need projLib to generate a separate APK, then you'll have to do some refactoring to pull the common code that you need out into a third library module, and have both APKs depend on it.
Libraries aren't allowed to set an applicationId
, so if you see an error message to that effect, remove it from the library's build script.
In module gradle file-
Replace apply plugin: 'com.android.application'
with apply plugin: 'com.android.library'
Then remove applicationId "xxx.xxx.xxxx"
Clean and Build