导入依赖

1.加入module

将一个module作为sample的依赖,
1.首先修改该module(我是用的test)的build.gradle文件

apply plugin: 'com.android.application'

改为

apply plugin: 'com.android.library'

并删除applicationId

2.ctrl+alt+shift+s打开如图界面,选择sample的依赖,选择 Module dependency,将test添加为依赖,重新编译

Paste_Image.png

有可能会出现这样的错误

Error:Execution failed for task ':sample:processDebugManifest'.
Manifest merger failed with multiple errors, see logs

原因是module和sample最小系统版本有差异


另一个错误

http://blog.csdn.net/u013113491/article/details/46518869

主项目sample修改manifest文件:

tools:replace="android:icon, android:theme"

需要namespace:  *xmlns:tools="http://schemas.android.com/tools" *


<manifest xmlns:android="http://schemas.android.com/apk/res/android"  
    xmlns:tools="http://schemas.android.com/tools"  
    package="com.leo.kang.demo"  
    android:versionCode="1"  
    android:versionName="1.0">  
  
    <uses-sdk  
        android:minSdkVersion="8"  
        android:targetSdkVersion="18" />  
  
    <application  
        android:allowBackup="true"  
        android:icon="@drawable/ic_launcher"  
        android:label="@string/app_name"  
        android:theme="@style/AppTheme"  
        tools:replace="android:icon, android:theme">  

2.删除module

http://blog.csdn.net/hyr83960944/article/details/37519299

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容