2015年7月21日 星期二

Android Studio import .aar & Eclipse lib project

# Import aar

  1. File --> New... --> New Module --> import .JAR or .AAR package, choose the specific aar file
  2. Add dependency
    File--> project structure ---> choose app(or other module use the lib)--> dependancies
    Add the imported module

    Or edit build.gradle directly:
    dependencies {
        compile project(
    ':resourceHosting' )
        compile project(
    ':iotivity-armeabi-v7a-base-debug' )
    }
  3. Sync gradle & build 



# Import aar -2

http://blog.csdn.net/qiujuer/article/details/39754517
NOTE: 這個方法在import多個aar時會出錯
如果兩個aar都有包多個.so檔,package的時候只會包到其中一個aar的.so檔

# Import eclipse project

  1. File-->New... --> Import Library... --> Choose the eclipse project folder
  2. Choose all option, press Finish
  3. Edit AndroidManifest.xml to remove wrong properties
    (Remove all properties with error)

  4. Edit build.gradle of the imported module
    Change apply plugin: 'com.android.application'
    to 
    apply plugin: 'com.android.library'
  5. Edit build.gradle remove other wrong fields, like applicationId
  6. Add dependency as described above
  7. Sync gradle & build