gpt4 book ai didi

java - Android Studio - 没有添加依赖项的选项?

转载 作者:太空宇宙 更新时间:2023-11-04 11:46:45 25 4
gpt4 key购买 nike

我想将 GooglePlayServices 添加到现有项目 (Libgdx)。但我有一个问题,将它们添加到 build.gradle 文件后,它们没有显示。我已经使用 SDK 管理器安装了 GooglePlayServices。我做错了什么..?

当我进入“依赖项”选项卡下的“项目结构”时,只有 3 个不同的选项:

  1. 添加 Jar 或文件夹( self 解释)

  2. 添加库

  3. 添加模块依赖项(当我单击此按钮时,我可以将我的主模块或核心模块添加为依赖项。没有其他选项)

这是我的项目树的图片:

ProjectTree

这是我的项目结构的图片:

Project Structure

我可以导入的唯一依赖项是模块...这很奇怪。

ModuleDependencie

这就是我的整个 build.gradle(我发布了所有内容,因为我完全不知道错误部分在哪里)我标记了我为 GooglePlayService 添加的行:

buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}

allprojects {
apply plugin: "eclipse"
apply plugin: "idea"

version = '1.0'
ext {
appName = "ParallelOrigin"
gdxVersion = '1.9.5'
roboVMVersion = '2.3.0'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}

repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}

project(":android") {
apply plugin: "android"

configurations { natives }

dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
compile "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86_64"
compile "de.tomgrill.gdxdialogs:gdx-dialogs-android:1.2.0"


//----------------------------------------------------------------------------//
//--------------------------Added by myself-----------------------------------//
//----------------------------------------------------------------------------//


compile "com.android.support:support-core-utils:23.2.1"
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.google.android.gms:play-services:10.0.1'
}
}

project(":core") {
apply plugin: "java"


dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
compile "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
compile "com.underwaterapps.overlap2druntime:overlap2d-runtime-libgdx:0.1.0"
compile "net.dermetfan.libgdx-utils:libgdx-utils:0.13.4"
compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d:0.13.4"
compile "de.tomgrill.gdxdialogs:gdx-dialogs-core:1.2.0"

//----------------------------------------------------------------------------//
//--------------------------Added by myself-----------------------------------//
//----------------------------------------------------------------------------//

compile "com.android.support:support-core-utils:23.2.1"
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.google.android.gms:play-services:10.0.1'
}
}

tasks.eclipse.doLast {
delete ".project"
}

感谢您的帮助和您的时间!

最佳答案

我找到了iusse!

这只是因为我的项目不是 gradle 项目而发生。我只需要迁移它,然后我就可以导入那些 Maven 依赖项!

关于java - Android Studio - 没有添加依赖项的选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42283162/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com