本人使用的是Android studio1.3版本,前几天调试通过的项目,现在编译出现了错误。错误信息如下
1 Project app: apk dependencies can only be jars. android:mgimlibs:aar:unspecified is an Android Library. 2 Project app: apk dependencies can only be jars. com.android.support:appcompat-v7:aar:19.1.0 is an Android Library.
并没有升级版本,觉得很奇怪。在尝试了许多办法后,终于找到了解决办法
在gradle文件中修改如下代码,将
1 apk project(‘:mgimlibs‘) 2 apk fileTree(include: [‘*.jar‘], dir: ‘libs‘) 3 4 apk ‘com.android.support:appcompat-v7:19.+‘ 5 apk ‘com.google.protobuf:protobuf-java:2.6.1‘ 6 apk ‘de.greenrobot:eventbus:2.4.0‘ 7 apk ‘de.greenrobot:greendao:1.3.7‘ 8 apk ‘com.google.code.gson:gson:2.3.1‘ 9 apk ‘com.squareup.okhttp:okhttp:2.0.0‘ 10 apk ‘com.squareup.okhttp:okhttp-urlconnection:2.0.0‘ 11 apk ‘commons-io:commons-io:2.4‘
修改为:
1 apk fileTree(include: [‘*.jar‘], dir: ‘libs‘) 2 3 compile ‘com.google.protobuf:protobuf-java:2.6.1‘ 4 compile ‘de.greenrobot:eventbus:2.4.0‘ 5 compile ‘de.greenrobot:greendao:1.3.7‘ 6 compile ‘com.google.code.gson:gson:2.3.1‘ 7 compile ‘com.squareup.okhttp:okhttp:2.0.0‘ 8 compile ‘com.squareup.okhttp:okhttp-urlconnection:2.0.0‘ 9 compile ‘commons-io:commons-io:2.4‘ 10 compile ‘com.android.support:appcompat-v7:19.+‘ 11 compile project(‘:mgimlibs‘)
然后在进行编辑就可以通过了。
原文:http://www.cnblogs.com/yuqt/p/5117448.html