问题描述
当我右键单击我的Android项目,选择运行 - > Android应用程序
。该模拟器被推出和变化做了反映。
但是当我做下面的下面的命令,它不反映。
MVN全新安装
MVN机器人:部署
MVN安卓模拟器启动
更多 - 过去,部署和仿真器启动命令,如果没有模拟器开辟了失败。 0找到设备的Android调试桥
连接
[错误]未能执行目标com.jayway.maven.plugins.android.generation2:安德烈
OID - Maven的插件:3.3.0:部署项目SampleProject(默认CLI):无在线德
恶习连接。 - > [说明1]
org.apache.maven.lifecycle.LifecycleExecutionException:未能执行目标Ç
om.jayway.maven.plugins.android.generation2:Android的Maven的插件:3.3.0:部署(D
EFAULT-CLI)项目SampleProject:无连接网络的设备。
在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
的.java:217)
在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
的.java:153)
在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
的.java:145)
在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
CT(LifecycleModuleBuilder.java:84)
在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
CT(LifecycleModuleBuilder.java:59)
在org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ILD(LifecycleStarter.java:183)
在org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
在org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
在org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
在org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
在org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl。
java的:39)
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
在java.lang.reflect.Method.invoke(Method.java:597)
在有机codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(洗衣机。
cher.java:290)
在有机codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
答:230)
在有机codehaus.plexus.classworlds.launcher.Launcher.mainWithExit code(香格里拉
uncher.java:409)
在组织codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
致:org.apache.maven.plugin.MojoExecutionException:无在线设备ATT
疼痛难忍。
在com.jayway.maven.plugins.android.AbstractAndroidMojo.doWithDevices(抗体
stractAndroidMojo.java:625)
在com.jayway.maven.plugins.android.AbstractAndroidMojo.deployApk(Abstra
ctAndroidMojo.java:527)
在com.jayway.maven.plugins.android.AbstractAndroidMojo.deployBuiltApk(A
bstractAndroidMojo.java:570)
在com.jayway.maven.plugins.android.standalonemojos.DeployMojo.execute(D
eployMojo.java:48)
在org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(默认
BuildPluginManager.java:101)
在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
的.java:209)
... 19更多
[错误]
[错误]使用-x开关来实现完整的调试日志记录重新运行Maven。
[错误]
[错误]有关错误和可能的解决方案,请意图的更多信息
D中的以下文章:
[错误] [说明1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
下面是我的android,Maven的插件仿真器-start.vbs文件。
暗淡oShell
设置oShell = WScript.CreateObject(WSCRIPT.SHELL)
oShell.runC:\ WINDOWS \ SYSTEM32 \ CMD.EXE / X / C START /独立的AndroidMavenPlugin-AVDDefaultD:\ SDK \工具\ emulator.exe -avd默认
下面是我的pom.xml
< XML版本=1.0编码=UTF-8&GT?;
<项目的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.sample< /的groupId>
< artifactId的> SampleProject< / artifactId的>
<版> 1.0< /版本>
<包装> APK< /包装>
<名称>&SampleProject LT; /名称>
<性状>
< platform.version> 2.3.3< /platform.version>
< project.build.sourceEncoding> UTF-8< /project.build.sourceEncoding>
< /性状>
<依赖>
<依赖>
<的groupId> com.google.android< /的groupId>
< artifactId的>的android< / artifactId的>
<版> $ {platform.version}< /版本>
<范围>提供与LT; /范围>
< /依赖性>
<依赖>
<的groupId> com.google code.androidannotations< /的groupId>
< artifactId的> androidannotations< / artifactId的>
<版> 2.5.1< /版本>
<范围>提供与LT; /范围>
< /依赖性>
<依赖>
<的groupId> com.google code.androidannotations< /的groupId>
< artifactId的> androidannotations< / artifactId的>
<分级> API< /分类>
<版> 2.5.1< /版本>
< /依赖性>
< /依赖性>
<建立>
<插件>
<插件>
<的groupId> com.jayway.maven.plugins.android.generation2< /的groupId>
< artifactId的> Android的行家,插件和LT; / artifactId的>
<版> 3.3.2< /版本>
<结构>
< SDK>
<! - 平台或API级(API级别4 = 1.6平台) - GT;
<平台> 16< /平台>
<路径> $ {env.ANDROID_HOME} /< /路径>
< / SDK>
<仿真器>
&其中; AVD> 21&所述; / AVD>
<选项> - 无 - 皮肤LT; /选项>
< /仿真器>
< undeployBeforeDeploy>假< / undeployBeforeDeploy>
< /结构>
<扩展>真< /扩展>
< /插件>
<插件>
< artifactId的> Maven的编译器插件< / artifactId的>
<版> 2.5.1< /版本>
<结构>
<信源> 1.6< /源>
<目标> 1.6< /目标和GT;
< /结构>
< /插件>
< /插件>
< /编译>
< /项目>
运行 MVN安卓模拟器启动
在 MVN安卓部署
。该Maven插件不能部署到不存在的模拟器。你还必须等待模拟器部署前启动。
使用 ADB设备
来检查连接到您的计算机的活动Android设备。
When i right-click my Android Project and Select Run->Android Application
. The emulator gets launched and the changes do reflect.
But when i do the following below commands, it does not reflect.
mvn clean install
mvn android:deploy
mvn android:emulator-start
More-Over, The deploy and emulator-start command fails if there is no emulator opened up.Found 0 devices connected with the Android Debug Bridge
.
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:andr
oid-maven-plugin:3.3.0:deploy (default-cli) on project SampleProject: No online de
vices attached. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal c
om.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.0:deploy (d
efault-cli) on project SampleProject: No online devices attached.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.apache.maven.plugin.MojoExecutionException: No online devices att
ached.
at com.jayway.maven.plugins.android.AbstractAndroidMojo.doWithDevices(Ab
stractAndroidMojo.java:625)
at com.jayway.maven.plugins.android.AbstractAndroidMojo.deployApk(Abstra
ctAndroidMojo.java:527)
at com.jayway.maven.plugins.android.AbstractAndroidMojo.deployBuiltApk(A
bstractAndroidMojo.java:570)
at com.jayway.maven.plugins.android.standalonemojos.DeployMojo.execute(D
eployMojo.java:48)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:209)
... 19 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
Here is my android-maven-plugin-emulator-start.vbs file.
Dim oShell
Set oShell = WScript.CreateObject("WScript.shell")
oShell.run "C:\Windows\system32\cmd.exe /X /C START /SEPARATE ""AndroidMavenPlugin-AVDDefault"" D:\SDK\tools\emulator.exe -avd Default"
Here is MY 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.sample</groupId>
<artifactId>SampleProject</artifactId>
<version>1.0</version>
<packaging>apk</packaging>
<name>SampleProject</name>
<properties>
<platform.version>2.3.3</platform.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${platform.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.googlecode.androidannotations</groupId>
<artifactId>androidannotations</artifactId>
<version>2.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.googlecode.androidannotations</groupId>
<artifactId>androidannotations</artifactId>
<classifier>api</classifier>
<version>2.5.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<sdk>
<!-- platform or api level (api level 4 = platform 1.6) -->
<platform>16</platform>
<path>${env.ANDROID_HOME}/</path>
</sdk>
<emulator>
<avd>21</avd>
<options>-no-skin</options>
</emulator>
<undeployBeforeDeploy>false</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run mvn android:emulator-start
before mvn android:deploy
. The maven plugin cannot deploy to an emulator that does not exist. You must also wait for the emulator to boot up before deploying.
Use adb devices
to check the active android devices that are connected to your computer.
这篇关于Android的Maven的没有启动模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!