用gradle管理android项目出现的问题以及解决方法
1.项目结构
最好是全部在root 项目配置
一个settings.gradle
一个build.gradle
2.多项目依赖
http://www.gradle.org/docs/current/userguide/multi_project_builds.html
55.7. Project lib dependencies
3.android-support-v4 all ready add
if you have other modules that depends on android-support-v4.jar, create a library project which contains the android-support-v4.jar and reference this project instead the jar file.
E.g.:
Add a project with this structure:
- android-support
- libs
- android-support-v4.jar
-AndroidManifest.xml
- build.gradle
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?><manifestxmlns:android="http://schemas.android.com/apk/res/android"android:versionCode="1"android:versionName="1.0"package="com.example.support.lib"><uses-sdkandroid:minSdkVersion="7"android:targetSdkVersion="7"/><application/></manifest>
build.gradle:
buildscript {
repositories {
mavenCentral()}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'}}
apply plugin:'android-library'
dependencies {
compile files ("libs/android-support-v4.jar")}
android {
compileSdkVersion 17
buildToolsVersion "17"
defaultConfig {
minSdkVersion 7
targetSdkVersion 7}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'}}}
remember to include this project in your projects settings.gradle:
include ':android-support'
now, for each project that requires the support library, instead of
compile files ("libs/android-support-v4.jar")
use the following line:
compile project (':android-support')
另外一个简单的方法可以解决此问题:
将:
compile files('libs/android-support-v4.jar')
用这个取代:
dependencies {
compile 'com.android.support:support-v4:13.0.0'
}
须知: You have to first use the SDK Manager and download and install
two Maven repositories: "Android Support Repository" and "Google
Repository".
解决完请使用gradle clean
才会生效
4.Could not find element /manifest/application.
需在AndroidManifest.xml中添加:
<application />
用gradle管理android项目出现的问题以及解决方法的更多相关文章
- java-idea创建maven管理web项目不能解析EL的解决方法
默认会原样输出: 这是由于这样子创建的web.xml的版本不够高 2.5之前web.xml文件中的头定义中,el表达式默认是忽略不解析的,故需要显示声明解析el表达式 所以我们要修改版本: 再< ...
- 使用Gradle构建Android项目
阅读目录 Gradle是什么? 环境需求 Gradle基本结构 任务task的执行 基本的构建定制 目录配置 签名配置 代码混淆设置 依赖配置 输出不同配置的应用 生成多个渠道包(以Umeng为例) ...
- [转载]关于安装Android Studio的一些问题的解决方法
最近在研究Android编程,在Android Studio安装和使用时遇到了麻烦,从园子里找到了<关于安装Android Studio的一些问题的解决方法>的,很多问题找到了解决办法. ...
- Android Studio support 26.0.0-alpha1 Failed to resolve: com.android.support:appcompat-v7:27.+ 报错解决方法
AS下如何生成自定义的.jks签名文件, 以及如何生成数字签名 链接:http://www.cnblogs.com/smyhvae/p/4456420.html 链接:http://blog.csdn ...
- Android SDK Manager 更新失败的解决方法
Android SDK Manager 更新失败的解决方法 原文地址 最近使用Android SDK Manager 更新Android SDK tools 发现经常更新失败,获取不到更新信息: Fe ...
- Android使用帧动画内存溢出解决方法
Android使用帧动画内存溢出解决方法https://blog.csdn.net/daitu_liang/article/details/52336015https://blog.csdn.net/ ...
- [RN] Android 设备adb连接后unauthorized解决方法
Android 设备adb连接后unauthorized解决方法 安卓设备usb或者adbwireless连接后输入adb device后都是未授权状态 相信很多同学都会遇到这种情况,除了一直重复开关 ...
- eclipse spring boot 项目出现java.lang.ClassCastException 解决方法
问题 eclipse spring boot 项目出现java.lang.ClassCastException 解决方法: 重新生成项目
- eclipse 新建项目不可选择Java Project 解决方法
解决方法一: 鼠标点击file-new-other,弹出选项框,选中java project,点击next,接下来就是正常创建java protect的流程了,这个虽然也可以解决,但每次新建java项 ...
随机推荐
- Route@简单应用
路由的简单应用(生成URL) 这篇文章讲的核心问题是利用路由系统生成URL但是我们,但是我们不是仅仅生成URL,我们的超链接的href属性中,我们在跳转的时候,都需要URL,我们要将的就是在这些实际情 ...
- redisTemplate 操作
redisDao封装类-其他dao集成他 package com.ffcs.wlan.dao.common; import javax.annotation.Resource; import org. ...
- C++-struct类的新特性当class用
#include <iostream> #include <iomanip> #include <string> using namespace std; stru ...
- SIX GOD
SIX GOD是什么意思呢.?_百度知道 SIX GOD
- android Asynctask的优缺点?是否能同一时候并发100+asynctask呢?
一 Asynctask的优缺点? AsyncTask,是android提供的轻量级的异步类,能够直接继承AsyncTask,在类中实现异步操作,并提供接口反馈当前异步运行的程度(能够通过接口实现UI ...
- Linux下mpi环境配置与执行步骤(Ubuntu为例)
转载注明出处: http://blog.csdn.net/bendanban/article/details/9136755 以两台计算机为例,将这两台计算机应用于MPI运行环境. 第一步:在两台机器 ...
- clearcase常用命令
版本控制工具学习 http://www.itpxpj.com/course.do?method=getAllCourseInFront&classTypeId=21 1.[ClearCase] ...
- Exchange Server 2013传输规则之全新附件限制
- 点击得到QTableWidget中任意位置QPushButton的行列信息
http://www.qtcn.org/bbs/read-htm-tid-51835.html http://www.qtcn.org/bbs/simple/?t43841.html 比如(点击每行最 ...
- Spring Uploading Files
1,在servlet-dispatcher.xml中添加代码 <bean id="multipartResolver" class="org.springframe ...