android Maven Caused by: org.apache.maven.project.DependencyResolutionException

发布于 2021-11-27 10:38:10 字数 12691 浏览 945 评论 4

  Android Maven 编译抛错,跪求高手回答。谢谢

Could not res olve dependencies for project com.example.mvnandroid:myapp:apk:0.0.1-SNAPSHOT: 

<generateApk default-value="true">${android.generateApk}</generateApk>

  <nativeLibrariesDirectory default-value="${project.basedir}/libs">${android.na
tiveLibrariesDirectory}</nativeLibrariesDirectory>
  <ndkPath>${android.ndk.path}</ndkPath>
  <proguardFile>${android.proguardFile}</proguardFile>
  <project>${project}</project>
  <projectRepos default-value="${project.remoteProjectRepositories}"/>
  <release default-value="false">${android.release}</release>
  <renameManifestPackage>${android.renameManifestPackage}</renameManifestPackage
>
  <repoSession default-value="${repositorySystemSession}"/>
  <resourceDirectory default-value="${project.basedir}/res"/>
  <resourceOverlayDirectory default-value="${project.basedir}/res-overlay"/>
  <sdk>
    <platform>18</platform>
  </sdk>
  <sdkPath>${android.sdk.path}</sdkPath>
  <sdkPlatform>${android.sdk.platform}</sdkPlatform>
  <session>${session}</session>
  <sourceDirectory default-value="${project.build.sourceDirectory}"/>
  <targetDirectory default-value="${project.build.directory}"/>
  <undeployBeforeDeploy default-value="false">${android.undeployBeforeDeploy}</u
ndeployBeforeDeploy>
  <unpackedApkLibsDirectory>${project.build.directory}/unpacked-libs</unpackedAp
kLibsDirectory>
</configuration>
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal:          com.jayway.maven.plugins.android.generation2:android-mave
n-plugin:3.8.2:dex (default-dex)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <aaptExtraArgs>${android.aaptExtraArgs}</aaptExtraArgs>
  <androidManifestFile default-value="${project.basedir}/AndroidManifest.xml">${
android.manifestFile}</androidManifestFile>
  <assetsDirectory default-value="${project.basedir}/assets"/>
  <attachJar default-value="true">${android.attachJar}</attachJar>
  <attachSources default-value="false">${android.attachSources}</attachSources>
  <combinedAssets>${project.build.directory}/generated-sources/combined-assets/a
ssets</combinedAssets>
  <configurations>${android.configurations}</configurations>
  <customPackage>${android.customPackage}</customPackage>
  <device>${android.device}</device>
  <dexCoreLibrary default-value="false">${android.dex.coreLibrary}</dexCoreLibra
ry>
  <dexIncremental default-value="false">${android.dex.incremental}</dexIncrement
al>
  <dexJvmArguments default-value="-Xmx1024M">${android.dex.jvmArguments}</dexJvm
Arguments>
  <dexNoLocals default-value="false">${android.dex.noLocals}</dexNoLocals>
  <dexOptimize default-value="true">${android.dex.optimize}</dexOptimize>
  <dexPreDex default-value="false">${android.dex.predex}</dexPreDex>
  <dexPreDexLibLocation default-value="${project.build.directory}${file.separato
r}dexedLibs">${android.dex.dexPreDexLibLocation}</dexPreDexLibLocation>
  <envAndroidHome>${env.ANDROID_HOME}</envAndroidHome>
  <execution>${mojoExecution}</execution>
  <extractedDependenciesDirectory>${project.build.directory}/generated-sources/e
xtracted-dependencies</extractedDependenciesDirectory>
  <extractedDependenciesJavaResources>${project.build.directory}/generated-sourc
es/extracted-dependencies/src/main/resources</extractedDependenciesJavaResources
>
  <extractedDependenciesJavaSources>${project.build.directory}/generated-sources
/extracted-dependencies/src/main/java</extractedDependenciesJavaSources>
  <generateApk default-value="true">${android.generateApk}</generateApk>
  <nativeLibrariesDirectory default-value="${project.basedir}/libs">${android.na
tiveLibrariesDirectory}</nativeLibrariesDirectory>
  <ndkPath>${android.ndk.path}</ndkPath>
  <obfuscatedJar>${android.proguard.obfuscatedJar}</obfuscatedJar>
  <proguardFile>${android.proguardFile}</proguardFile>
  <project>${project}</project>
  <projectRepos default-value="${project.remoteProjectRepositories}"/>
  <release default-value="false">${android.release}</release>
  <renameManifestPackage>${android.renameManifestPackage}</renameManifestPackage
>
  <repoSession default-value="${repositorySystemSession}"/>
  <resourceDirectory default-value="${project.basedir}/res"/>
  <resourceOverlayDirectory default-value="${project.basedir}/res-overlay"/>
  <sdk>
    <platform>18</platform>
  </sdk>
  <sdkPath>${android.sdk.path}</sdkPath>
  <sdkPlatform>${android.sdk.platform}</sdkPlatform>
  <session>${session}</session>
  <sourceDirectory default-value="${project.build.sourceDirectory}"/>
  <targetDirectory default-value="${project.build.directory}"/>
  <undeployBeforeDeploy default-value="false">${android.undeployBeforeDeploy}</u
ndeployBeforeDeploy>
  <unpackedApkLibsDirectory>${project.build.directory}/unpacked-libs</unpackedAp
kLibsDirectory>
</configuration>
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal:          org.apache.maven.plugins:maven-jar-plugin:2.6:jar (defaul
t-jar)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <classesDirectory default-value="${project.build.outputDirectory}"/>
  <classifier default-value="">${maven.jar.classifier}</classifier>
  <defaultManifestFile default-value="${project.build.outputDirectory}/META-INF/
MANIFEST.MF"/>
  <finalName default-value="${project.build.finalName}">${jar.finalName}</finalN
ame>
  <forceCreation default-value="false">${jar.forceCreation}</forceCreation>
  <outputDirectory default-value="${project.build.directory}"/>
  <project default-value="${project}"/>
  <session default-value="${session}"/>
  <skipIfEmpty default-value="false">${jar.skipIfEmpty}</skipIfEmpty>
  <useDefaultManifestFile default-value="false">${jar.useDefaultManifestFile}</u
seDefaultManifestFile>
</configuration>
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal:          com.jayway.maven.plugins.android.generation2:android-mave
n-plugin:3.8.2:apk (default-apk)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <aaptExtraArgs>${android.aaptExtraArgs}</aaptExtraArgs>
  <androidManifestFile default-value="${project.basedir}/AndroidManifest.xml">${
android.manifestFile}</androidManifestFile>
  <apkDebug>${android.apk.debug}</apkDebug>
  <apkMetaIncludes>${android.apk.metaIncludes}</apkMetaIncludes>
  <apkNativeToolchain>${android.nativeToolchain}</apkNativeToolchain>
  <assetsDirectory default-value="${project.basedir}/assets"/>
  <attachJar default-value="true">${android.attachJar}</attachJar>
  <attachSources default-value="false">${android.attachSources}</attachSources>
  <combinedAssets>${project.build.directory}/generated-sources/combined-assets/a
ssets</combinedAssets>
  <configurations>${android.configurations}</configurations>
  <customPackage>${android.customPackage}</customPackage>
  <device>${android.device}</device>
  <envAndroidHome>${env.ANDROID_HOME}</envAndroidHome>
  <execution>${mojoExecution}</execution>
  <extractDuplicates default-value="false">${android.extractDuplicates}</extract
Duplicates>
  <extractedDependenciesDirectory>${project.build.directory}/generated-sources/e
xtracted-dependencies</extractedDependenciesDirectory>
  <extractedDependenciesJavaResources>${project.build.directory}/generated-sourc
es/extracted-dependencies/src/main/resources</extractedDependenciesJavaResources
>
  <extractedDependenciesJavaSources>${project.build.directory}/generated-sources
/extracted-dependencies/src/main/java</extractedDependenciesJavaSources>
  <generateApk default-value="true">${android.generateApk}</generateApk>
  <nativeLibrariesDependenciesHardwareArchitectureDefault default-value="armeabi
">${android.nativeLibrariesDependenciesHardwareArchitectureDefault}</nativeLibra
riesDependenciesHardwareArchitectureDefault>
  <nativeLibrariesDirectory default-value="${project.basedir}/libs">${android.na
tiveLibrariesDirectory}</nativeLibrariesDirectory>
  <nativeLibrariesOutputDirectory default-value="${project.build.directory}/libs
"/>
  <ndkFinalLibraryName>${android.ndk.build.build.final-library.name}</ndkFinalLi
braryName>
  <ndkPath>${android.ndk.path}</ndkPath>
  <proguardFile>${android.proguardFile}</proguardFile>
  <project>${project}</project>
  <projectRepos default-value="${project.remoteProjectRepositories}"/>
  <release default-value="false">${android.release}</release>
  <renameInstrumentationTargetPackage>${android.renameInstrumentationTargetPacka
ge}</renameInstrumentationTargetPackage>
  <renameManifestPackage>${android.renameManifestPackage}</renameManifestPackage
>
  <repoSession default-value="${repositorySystemSession}"/>
  <resourceDirectory default-value="${project.basedir}/res"/>
  <resourceOverlayDirectory default-value="${project.basedir}/res-overlay"/>
  <sdk>
    <platform>18</platform>
  </sdk>
  <sdkPath>${android.sdk.path}</sdkPath>
  <sdkPlatform>${android.sdk.platform}</sdkPlatform>
  <session>${session}</session>
  <signDebug default-value="auto">${android.sign.debug}</signDebug>
  <sourceDirectories default-value="">${android.sourceDirectories}</sourceDirect
ories>
  <sourceDirectory default-value="${project.build.sourceDirectory}"/>
  <targetDirectory default-value="${project.build.directory}"/>
  <undeployBeforeDeploy default-value="false">${android.undeployBeforeDeploy}</u
ndeployBeforeDeploy>
  <unpackedApkLibsDirectory>${project.build.directory}/unpacked-libs</unpackedAp
kLibsDirectory>
</configuration>
[DEBUG] =======================================================================
[WARNING] The POM for android:android

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

流心雨 2021-12-01 00:00:00

我也是刚接触

<build>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.8.2</version>
                <configuration>
                    <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
                    <assetsDirectory>${project.basedir}/assets</assetsDirectory>
                    <resourceDirectory>${project.basedir}/res</resourceDirectory>
                    <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
                    <sdk>
                        <platform>15</platform>
                    </sdk>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

可能buils 没有配置 androidManifestFile 这些,找不到这些文件

半世蒼涼 2021-11-30 18:54:20

Could not resolve dependencies for project com.example.mvnandro

id:myapp:apk:0.0.1-SNAPSHOT:  Failure to find android:android:jar:4.3

应该是 下载 https://github.com/mosabua/maven-android-sdk-deployer

cd 进入到D:AndroidInstallmaven-android-sdk-deployer-master

目录, mvn install 安装全部sdk支持pom。

如果缺少 4.3  可以安装一个 mvn install -P 4.3

你本地SDK需要有

D:AndroidInstallandroid-sdk-windowsplatforms 4.3的SDK

D:AndroidInstallandroid-sdk-windowsadd-ons 下18的api

沙与沫 2021-11-30 11:42:49

没找到本地SDK,或者build里配置寻找src res manifest没有找到!

路还长,别太狂 2021-11-29 12:09:31

Failure to find android:android:jar:4.3 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval ofcentral has elapsed or updates are forced ……

不能指定本地sdk么?我用gradle的,不了解。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文