用了一段时间Studio,总体感觉的确比Eclipse要好用些,特别是在依赖库的设置上相当方便。但是其中也遇到很多问题,暂时记录在下面:


之前编译正常,但是今早升级到0.60, gradle插件升级到0.11(gradle版本1.12)以后出来好几个问题

,在merge Manifest的时候报错:

Error:(31, 9)Attribute application@icon value=(@drawable/ic_launcher) fromAndroidManifest.xml:31:9

Error:(29, 9)Attribute application@name value=(com.wooxcloud.wooxregistry.WxApplication)from AndroidManifest.xml:29:9

Error:(33, 9)Attribute application@theme value=(@style/Theme.Sherlock) fromAndroidManifest.xml:33:9

is also present at WooxMainActivity.libs:vlc-android:unspecified:27:9 value=(@style/Theme.VLC.NoTitleBar)

Suggestion: add 'tools:replace="theme"' to <application> element at AndroidManifest.xml:29:5 to override

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

网上查了查,发现http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger

有讲新版本改变了merge的方法,对于conflict可以加tools:replace来解决

xmlns:tools="http://schemas.android.com/tools"

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

package="com.xxxx.xxxx"

xmlns:tools="http://schemas.android.com/tools"

android:versionCode="1"

android:versionName="1.0" >

然后再冲突的地方

<application

android:name="com.xxxx.xxxx.xxApplication"

android:allowBackup="false"

android:icon="@drawable/ic_launcher"

android:label="@string/app_name"

android:theme="@style/Theme.Sherlock"

tools:replace="name,icon,label,theme">

然后编译通过

从eclipse import了一个项目,编译报找不到依赖库,

Error:(13, 0) Project with path ':libs:ActionBarSherlock' could not be found in root project 'WooxMainActivity'.

查了查发现根目录没有settings.gradle文件,创建一个加入如下内容:

include 'libs:ActionBarSherlock', 'libs:vlc-android', 'libs:SlidingMenu', 'libs:WheelView'

从Eclipse导入项目,报找不到application ID以及minSdkVersion不对:

Error:Failed to get application id for debug

在build.gradle里面发现defaultConfig {}没有东西

加入

android {


...

defaultConfig {

applicationId 'com.wooxcloud.wooxregistry'

minSdkVersion 10

targetSdkVersion 17

versionCode 1

versionName '1.0'

}

问题解决。.