从我的理解,apklib包含代码+资源共享Maven.
aar文件分发Gradle.
在aar从apklib在一个主要方式不同:类被编译并包含在AAR的根classes.jar.而apklib不能包含已编译的类文件或jar.
1有人可以解释apklibvs aar文件之间的主要区别吗?
2可以Maven用aar吗?可以Gradle用apklib?
3哪种格式"更好"?
android apklib android-maven-plugin android-gradle-plugin aar
我很难过.我们最近将我们的Android项目转换为Maven项目.我的合作伙伴正在使用IntelliJ而我正在使用Eclipse.他说这可以通过他的设置很好地构建.
我是Maven的新手并且已经按照教程阅读了我能找到的所有内容来尝试解决这个问题.
我的pom.xml文件中有以下错误:
Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.2:proguard (execution: default-proguard,
phase: process-classes)
- Plugin execution not covered by lifecycle configuration: com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.2:generate-sources (execution: default-
generate-sources, phase: generate-sources)
Run Code Online (Sandbox Code Playgroud)
这是我的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.groupmd.clientandroid</groupId>
<artifactId>clientandroid</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>GroupMD</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<version>r7</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>actionbarsherlock</artifactId>
<version>4.2.0</version>
<type>apklib</type>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.3.2</version>
<extensions>true</extensions> …Run Code Online (Sandbox Code Playgroud) 我们正在为Android开发标准化我们的基础架构,并且我们正在尝试将依赖关系管理整合到我们的Android库项目中.我目前的轨道是使用带有m2e-android的maven android插件.我们已使用Android SDK Deployer将Android工件上传到Artifactory存储库.我们还有一个内部框架,我们可以将几个库导入到我们的项目中,并且大多数情况下它都可以正常工作.
我们现在面临的问题是包含资源文件的apklib依赖项很难设置.maven插件可以正确配置类路径,但如果apklib具有需要由父Android项目引用的资源文件,则除非您签出库项目并通过ADT将其链接到父项目,否则Eclipse无法找到它们.
在阅读问题https://github.com/rgladwell/m2e-android/issues/8上的m2e-android讨论后,https://stackoverflow.com/questions/6269816/creating-closed-source-android-libraries#answer- 6270768和APKLIB没有安装在Maven Repo中,我不相信maven是直到ADT正确支持闭源apk库的方式.
我想知道你是如何在Android项目上处理这些依赖项的.除了使用Maven之外还有哪些策略?
作为参考,这是我们到目前为止所尝试的内容.
我正在尝试使用maven构建一个android项目.但是当我运行:mvn clean install时出现以下错误:
执行default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.4.1:generate- sources failed:找不到工具'aapt'.请在插件中提供正确的Android SDK目录路径作为配置参数<\ sdk> <\ path> ... </ path> </ sdk>.作为替代方法,您可以将参数添加到命令行:-Dandroid.sdk.path = ...或设置环境变量ANDROID_HOME. - > [帮助1]
我已将ANDROID_HOME设置为sdk目录.这可能是什么问题?
我实际上是Maven框架的新手.我已经有了一个Maven项目.我从http://m2eclipse.sonatype.org/sites/m2e将Maven插件等安装到我的EclipseIDE中.然后我导入了我的项目并启用了依赖项,但该项目显示的错误太多.pom.xml本身显示错误.错误是
Project Build Error:unknown packaging:apk
Project Build Error:unresolvable build extension:plugin"
Run Code Online (Sandbox Code Playgroud)
等等
我的错误区域是:
project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.nbc.cnbc.android</groupId>
<artifactId>android.domain.tests</artifactId>
<version>1.0.0</version>
<packaging>apk</packaging>
<parent>
<groupId>com.nbc.cnbc.android</groupId>
<artifactId>android.domain.parent</artifactId>
<version>1.0.0</version>
<relativePath>../android.domain.parent/pom.xml</relativePath>
</parent>
<name>android.domain.tests</name>
<url>http://maven.apache.org</url>
Run Code Online (Sandbox Code Playgroud)
可能是因为最后一行中指定的网址可能不同吗?任何想法为什么会发生这种情况?任何回复都非常感谢.非常感谢提前!!
在尝试使用Maven构建Android项目时,我认识到maven-android-plugin在构建期间不会自动生成BuildConfig类.我找到了关于该问题的机票和Google Groups线程.
问题:http://code.google.com/p/maven-android-plugin/issues/detail?id = 275
Google网上论坛:http://groups.google.com/group/maven-android-developers/browse_thread/thread/cc74267bbb7baebb/4e63b710513bb535?lnk=gst&q=BuildConfig#4e63b710513bb535
问题线程中的快速黑客建议创建另一个微型maven项目,以便在构建时使用配置文件切换设置BuildConfig.DEBUG变量.这将迫使我为每一个小应用程序构建一个多模块项目.
Google Groups线程中的建议对我来说听起来不错(从SDK执行Ant任务以生成BuildConfig类)但是在挖掘build.xml并尝试完成这项工作之后我放弃了.
有没有人通过maven + android获得BuildConfig问题的实用工作解决方案?
所以我正在进行maven-ing facebook-android-sdk以包含在我们的CI流程中.
Facebook的/ pom.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.facebook.android</groupId>
<artifactId>facebook-android-sdk</artifactId>
<version>3.0.0-SNAPSHOT</version>
<name>facebook-android-sdk</name>
<packaging>apklib</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<version>r7</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.4.1</version>
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>ignored</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<nativeLibrariesDirectory>ignored</nativeLibrariesDirectory>
<sdk>
<platform>16</platform>
</sdk>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>maven-replacer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<ignoreMissingFile>false</ignoreMissingFile>
<file>target/generated-sources/r/com/facebook/android/R.java</file>
<outputFile>target/generated-sources/r/com/facebook/android/R.java</outputFile>
<regex>false</regex>
<token>static …Run Code Online (Sandbox Code Playgroud) android pom.xml maven facebook-android-sdk android-maven-plugin
我有一个使用Maven的Android项目.
它适用于运行Windows XP的旧计算机.但现在在我的另一台计算机上运行maven时出现此错误:
Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources (default-generate-sources) on project my-android-application: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources failed: A required class was missing while executing com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources: Lorg/sonatype/aether/RepositorySystem;
Run Code Online (Sandbox Code Playgroud)
我正在运行Windows 7 32位.
C:\Checkouts\Project\Src\Android\BuildResources>mvn -version
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 10:15:32+0800)
Maven home: C:\Programs\apache-maven-3.1.0
Java version: 1.6.0_33, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_33\jre
Default locale: en_SG, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
Run Code Online (Sandbox Code Playgroud) 为我的Android应用程序添加支持,我installLocation在我的IDE(IntelliJ)中将我的android级别从7提高到8.Android应用程序从IntelliJ构建良好.
我们虽然使用maven,但是从Maven开始无法编译.
[ERROR] C:\dev\svnlocal\5x\android\AndroidManifest.xml:3: error: No resource identifier found for attribute 'installLocation' in package 'android'
[ERROR] Error when generating sources.
Run Code Online (Sandbox Code Playgroud)
我还补充道
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="8"/>
Run Code Online (Sandbox Code Playgroud)
我一直在
No resource identifier found for attribute 'installLocation' in package 'android'
Run Code Online (Sandbox Code Playgroud)
我改变了我的依赖性
<dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
<version>2.1_r1</version>
<scope>provided</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
至
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
但我仍然收到此错误消息.
少了什么东西?
我正在使用maven android插件来构建我的项目并将它们部署到设备上.
使用mvn clean install android:undeploy android:deploy我可以成功部署到我的2.2中兴刀片:
[INFO] Found 1 devices connected with the Android Debug Bridge
[INFO] android.device parameter not set, using all attached devices
[INFO] Successfully uninstalled com.jameselsey.apps from P729J_SBM_ZTE_ZTE-BLADE
[INFO] Found 1 devices connected with the Android Debug Bridge
[INFO] android.device parameter not set, using all attached devices
[INFO] Successfully installed D:\development\james-projects\MyApp\target\myapp-0.5-SNAPSHOT.apk to P729J_SBM_ZTE_ZTE-BLADE
Run Code Online (Sandbox Code Playgroud)
但是当我在2.3.3上插入三星GT-I9000时,这似乎不起作用,这就是我得到的:
[INFO] Found 1 devices connected with the Android Debug Bridge
[INFO] android.device parameter not set, using all attached devices
[INFO] …Run Code Online (Sandbox Code Playgroud)