zoukankan      html  css  js  c++  java
  • Ubuntu 14.04 Android 使用Maven二 创建自己的Mavenproject

    依据https://code.google.com/p/maven-android-plugin/wiki/GettingStarted 介绍,有两种方法能够创建Mavenproject。

    第一种方法是用archetype, 可是我使用了之后,发现archetype产生的项目编译时有一个依赖找不到,无论了,先换其它方法。

    另外一种方法就是使用android命令行创建项目,然后复制样例代码project的pom文件并改动,

    Ubuntu 14.04 设置Android开发环境 描写叙述了怎样用命令行创建项目

    Ubuntu 14.04 Android 使用Maven一 使用样例project介绍了样例projecthelloflashlight


    先创建一个项目mvn_example1

    android create project --target android-10 --name mvn_example1 --path mvn_example1 --activity MainActivity --package org.csfreebird
    Created project directory: mvn_example1
    Created directory /home/dean/work/gitlab_cloud/android/example/mvn_example1/src/org/csfreebird
    Added file mvn_example1/src/org/csfreebird/MainActivity.java
    Created directory /home/dean/work/gitlab_cloud/android/example/mvn_example1/res
    Created directory /home/dean/work/gitlab_cloud/android/example/mvn_example1/bin
    Created directory /home/dean/work/gitlab_cloud/android/example/mvn_example1/libs
    Created directory /home/dean/work/gitlab_cloud/android/example/mvn_example1/res/values
    Added file mvn_example1/res/values/strings.xml
    Created directory /home/dean/work/gitlab_cloud/android/example/mvn_example1/res/layout
    Added file mvn_example1/res/layout/main.xml
    Added file mvn_example1/AndroidManifest.xml
    Added file mvn_example1/build.xml
    Added file mvn_example1/proguard-project.txt

    如今复制heelloflashlight的pom.xml文件到该项目文件夹下, 然后改动当中的一些配置:

      <groupId>org.freebird</groupId>
      <artifactId>example1</artifactId>
      <version>1.0.0</version>
      <packaging>apk</packaging>
    
      <name>mvn_example1</name>
    设置platform版本号为10,这里使用的是API Level,也能够使用platform level: 2.3.3, 详细能够通过命令android list targets, 只是这里眼下还仅仅能设置16, 设置10部署会失败,临时不明确原因。
        <plugins>
          <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <configuration>
              <sdk>
                <!-- platform as api level (api level 16 = platform 4.1)-->
                <platform>10</platform>
              </sdk>
            </configuration>
          </plugin>
        </plugins>

    删除掉ant相关的文件:

    mvn_example1$ rm -r bin build.xml build.properties libs
    rm: cannot remove ‘build.properties’: No such file or directory

    启动模拟设备后,执行以下的命令编译和部署:

    mvn clean install
    mvn android:deploy

    部署成功后,会看到模拟设备上出现程序图标。

    点击执行,成功。




  • 相关阅读:
    Django之使用内置函数和celery发邮件
    Django之FBV和CBV的用法
    使用xampp将angular项目运行在web服务器
    Django之使用中间件解决前后端同源策略问题
    Spring cloud Feign 调用端不生效
    进程同步——哲学家进餐问题Java实现
    数据库事务四大特性、隔离级别
    B树 B+树 红黑树
    SpringCloud Config Bus webhook 只能刷新config server 不能刷新config client
    Java8 容器类详解
  • 原文地址:https://www.cnblogs.com/zfyouxi/p/3804537.html
Copyright © 2011-2022 走看看