任我行一:基础结构

选用的一些框架

  1. 使用 maven 来管理整个项目,之前也有开发过 maven 管理的安卓项目。使用 maven 可以很方便划分模块。

  2. 地图首先使用高德地图,在精确度方面个人觉得要比百度的好。

  3. 基于谷歌 mytracks 项目,目前该项目已经没有更新了。


实现的主要功能

  1. 首先实现的最核心的功能是定位功能。

  2. 然后是描绘轨迹功能。


项目地址

https://git.oschina.net/qzz/IRide


POM文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://maven.apache.org/POM/4.0.0"
    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.qzz.android</groupId>
    <artifactId>app.iride</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>apk</packaging>
    <name>IRide</name>


    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
        <!-- at test time this will be overridden with snapshot version -->
        <it-plugin.version>4.0.0-rc.2</it-plugin.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>android</groupId>
            <artifactId>android</artifactId>
            <version>4.4.2_r4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>android</groupId>
            <artifactId>support-v4</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.1.43</version>
        </dependency>

        <dependency>
            <groupId>com.autonavi</groupId>
            <artifactId>amap</artifactId>
            <version>v3</version>
            <classifier>armeabi</classifier>
            <type>so</type>
        </dependency>
        <dependency>
            <groupId>com.autonavi</groupId>
            <artifactId>amap</artifactId>
            <version>v3ex</version>
            <classifier>armeabi</classifier>
            <type>so</type>
        </dependency>
        <dependency>
            <groupId>com.autonavi</groupId>
            <artifactId>amap2d</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>com.autonavi</groupId>
            <artifactId>amap3d</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>com.autonavi</groupId>
            <artifactId>location</artifactId>
            <version>1.3.2</version>
        </dependency>
    </dependencies>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>${it-plugin.version}</version>
                    <configuration>
                        <!--<androidManifestFile>${basedir}/AndroidManifest.xml</androidManifestFile>
                        <assetsDirectory>${basedir}/assets</assetsDirectory>
                        <resourceDirectory>${basedir}/res</resourceDirectory>
                        <nativeLibrariesDirectory>${basedir}/libs</nativeLibrariesDirectory>-->
                        <sdk>
                            <platform>19</platform>
                        </sdk>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.2</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <configuration>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>

            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>


</project>

由于SDK 在Maven库中不齐全,需要用到一个工具来安装新版的android sdk. Maven Android SDK Deployer.

高德的库也需要安装到本地仓库中,

/**
在app目录下复制后运行
*/



mvn install:install-file -DgroupId=com.autonavi -DartifactId=amap -Dversion=v3 -Dfile=deps\armeabi\libamapv304.so -Dpackaging=so -DgeneratePom=true -Dclassifier=armeabi

mvn install:install-file -DgroupId=com.autonavi -DartifactId=amap -Dversion=v3ex -Dfile=deps\armeabi\libamapv304ex.so -Dpackaging=so -DgeneratePom=true -Dclassifier=armeabi

mvn install:install-file -DgroupId=com.alibaba -DartifactId=fastjson -Dversion=1.1.43 -Dfile=deps\fastjson-1.1.43.android.jar -Dpackaging=jar -DgeneratePom=true

mvn install:install-file -DgroupId=com.autonavi -DartifactId=amap2d -Dversion=2.4.0 -Dfile=deps\Android_2DMap_V2.4.0.jar -Dpackaging=jar -DgeneratePom=true

mvn install:install-file -DgroupId=com.autonavi -DartifactId=amap3d -Dversion=2.4.0 -Dfile=deps\Android_3DMap_V2.4.0.jar -Dpackaging=jar -DgeneratePom=true

mvn install:install-file -DgroupId=com.autonavi -DartifactId=location -Dversion=1.3.2 -Dfile=deps\Android_Location_V1.3.2.jar -Dpackaging=jar -DgeneratePom=true

复制之后运行,将工程中的库文件安装到本地仓库。

参考了文章 http://keepcleargas.bitbucket.org/android/2014/04/01/using-maven-to-package-android.html


你可能感兴趣的:(任我行一:基础结构)