美文网首页
导入依赖

导入依赖

作者: MalDev | 来源:发表于2016-12-23 16:08 被阅读0次

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

相关文章

网友评论

      本文标题:导入依赖

      本文链接:https://www.haomeiwen.com/subject/hvmkvttx.html