使用jar输出而不是aar编译MPAndroidChart lib

时间:2016-03-21 18:56:47

标签: gradle mpandroidchart

如何将MPAndroidChart库编译为jar而不是aar?如果我运行gradle assembleDebug它将生成一个aar,但我在旧的MPAndroidChart发行版中看到它们已经提供了jar依赖。

我没有在自述文件中找到任何与gradle编译指令有关的内容。 “gradle任务”也没有帮助我。

这里有任何帮助吗?

感谢。

1 个答案:

答案 0 :(得分:0)

这个问题刚才被提出过,但这是未来开发人员的参考。

  1. 创建一个eclipse项目,其中包含您在Android Makefile上看到的确切包结构(https://github.com/PhilJay/MPAndroidChart/releases
  2. 将项目转换为Maven项目(右键单击,配置,转换为maven项目。
  3. 使用以下内容替换生成的MPAndroidChartLib

    pom.xml
  4. 右键点击pom,然后点击<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.github.mikephil</groupId> <artifactId>MPAndroidChart</artifactId> <version>1.4.2-SNAPSHOT</version> <name>MPAndroidChart</name> <description>A simple Android chart view/graph view library, supporting line- bar- and piecharts as well as scaling, dragging and animations</description> <url>https://github.com/PhilJay/MPAndroidChart</url> <packaging>jar</packaging> <build> <sourceDirectory>src</sourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins> </build> <properties> <jdk.version>1.7</jdk.version> </properties> <dependencies> <dependency> <groupId>com.google.android</groupId> <artifactId>android</artifactId> <scope>provided</scope> <version>4.1.1.4</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>1.9.5</version> </dependency> </dependencies> <issueManagement> <url>https://github.com/PhilJay/MPAndroidChart/issues</url> <system>GitHub Issues</system> </issueManagement> <licenses> <license> <name>Apache License Version 2.0</name> <url>http://www.apache.org/licenses/LICENSE-2.0.html</url> <distribution>repo</distribution> </license> </licenses> <scm> <url>https://github.com/PhilJay/MPAndroidChart</url <connection>scm:git:git://github.com/PhilJay/MPAndroidChart.git</connection> <developerConnection>scm:git:git@github.com:PhilJay/MPAndroidChart.git</developerConnection> </scm> <developers> <developer> <name>Philipp Jahoda</name> <email>philjay.librarysup@gmail.com</email> <url>http://stackoverflow.com/users/1590502/philipp-jahoda</url> <id>PhilJay</id> </developer> </developers> </project>

  5. 您可以在maven install

  6. 下找到该jar