相关疑难解决方法(0)

无法解决:com.google.android.gms:使用gradle在IntelliJ Idea中播放服务

我正在尝试在IntelliJ Idea中为我的libGDX项目添加Google Play服务.我已按照此处的设置指南进行操作:https://developers.google.com/android/guides/setup

这看起来非常简单.我刚刚在相应的部分中将这些行添加到我的build.gradle中,所以现在看起来像:

project(":android") {
    apply plugin: "android"
    apply plugin: 'com.android.application'

    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-platform:$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-x86"
        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.google.android.gms:play-services:11.2.0'
    }
}
Run Code Online (Sandbox Code Playgroud)

然后我尝试在Idea中同步我的gradle项目,以获得"无法解决"错误.

好吧,设置指南还说"确保每次更新Google Play服务时都更新此版本号",但问题是找到该版本号几乎是不可能的:根据Android SDK我的Google Play Services SDK版本manager是"43",到目前为止,我无法将这样的"11.2.0"或任何典型的版本字符串与"43"版本号相关联.并非设置指南对此没有任何说明.

无论如何,我从与此相关的众多问题中尝试了很多事情但无济于事.具体来说,我必须指出我确实更新了我的Android SDK,我确信它是Idea正在使用的那个(我已经三次检查了这个......):

Android SDK Manager 项目结构

我正在使用API​​级别26,但无论如何其他定义确实使用Android SDK的相同目录.此外,我没有在这台笔记本电脑上安装任何其他Android SDK,所以毫无疑问,Idea只使用那个和那个.

任何想法都非常受欢迎.

提前致谢!

java android intellij-idea gradle libgdx

68
推荐指数
6
解决办法
11万
查看次数

在 Android Studio 3.6 中禁用 Gradle 离线模式

我将我的 Android Studio 应用程序更新到 Mac 上的最新版本到 Android Studio 3.6,版本:#AI-192.7142.36.36.6200805

当构建由于 Internet 连接问题而失败时,我看到了启用离线模式的选项(在构建输出区域左右),我是通过单击提供的链接来实现的。

后来,我需要禁用离线模式,并按照正常步骤操作:

转到首选项 > 构建、执行、部署 > Gradle。

但是在这个版本的 Gradle 选项上,没有检查离线工作复选框

我的问题是:

如何在最新版本的 Android Studio 下禁用离线模式?

android intellij-idea android-studio

16
推荐指数
1
解决办法
9215
查看次数

无法从Android studio 3.1.1生成apk

当我尝试生成签名的APK时,我发现了这个问题:

10:58生成签名APK:构建APK时出错.您可以在"消息"视图中找到错误.没有缓存版本的com.android.tools.lint:lint-gradle:26.1.1可用于脱机模式.

这是我的android studio详细信息:

Android Studio 3.1.1
Build #AI-173.4697961, built on April 4, 2018
JRE: 1.8.0_152-release-1024-b02 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Run Code Online (Sandbox Code Playgroud)

这个块用于签署apk:

  buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.releaseconfig
    }
    debug {

        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'
    }

}  signingConfigs {
    releaseconfig {
        keyAlias 'release_key'
        keyPassword 'xxxxx'
        storeFile file('xxxxxx)
        storePassword 'xxxx'
    }
}
Run Code Online (Sandbox Code Playgroud)

android gradle build.gradle android-studio-3.1

13
推荐指数
2
解决办法
1万
查看次数

没有缓存版本的gradle

同步gradle时出现此错误.我对gradle很新,所以无法弄清楚究竟是什么问题?

错误:没有可用于脱机模式的com.android.tools.build:gradle:0.10.1的缓存版本.

当我去Setting->Gradle,我有离线模式勾选并使用默认的gradle包装.

android android-studio android-gradle-plugin

9
推荐指数
4
解决办法
2万
查看次数

无法为 org.gradle.api.Project 类型的根项目“android”获取未知属性“android”

我尝试将 Onesignal 作为推送服务添加到应用程序,但现在在编辑 build.gradle 文件后出现以下错误。

错误:无法获取类型为 org.gradle.api.Project 的根项目“android”的未知属性“android”。

有人可以告诉我如何解决这个问题吗?这是我第一次编辑 android 项目。

那是我的 build.gradle(app) 文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28
        applicationId "io.gonative.android.azndpe"
        versionCode 2

        manifestPlaceholders = [manifestApplicationId: "${applicationId}",
                                onesignal_app_id: "APP-ID",
                                onesignal_google_project_number: "REMOTE"]
    }

    signingConfigs {
        release {
            storeFile file("../../release.keystore")
            storePassword "password"
            keyAlias "release"
            keyPassword "password"
        }
        upload {
            storeFile file("../../upload.keystore")
            storePassword "password"
            keyAlias "upload"
            keyPassword "password"
        }
    }

    buildTypes {
        debug {
            applicationIdSuffix ".debug"
        }
        releaseApk {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
            zipAlignEnabled …
Run Code Online (Sandbox Code Playgroud)

android android-studio build.gradle

9
推荐指数
1
解决办法
1万
查看次数

无法使用react-native为Android构建

我正在尝试运行react-native run-android但我不断得到这个错误.我正在模拟器上运行.我开始使用应用程序react-native init.

PS:我在代理上运行.

当我试图跑

react-native run-android

我明白了:

FAILURE: Build failed with an exception.

*  What went wrong:
 A problem occurred configuring root project 'AwesomeProject'.
 > Could not resolve all dependencies for configuration ':classpath'.
 > Could not resolve com.android.tools.build:gradle:2.2.3.
 Required by:
     :AwesomeProject:unspecified
  > Could not resolve com.android.tools.build:gradle:2.2.3.
     > Could not get resource 'https://jcenter.bintray.com/com/android/tool
/build/gradle/2.2.3/gradle-2.2.3.pom'.
        > Could not GET 'https://jcenter.bintray.com/com/android/tools/buil
 /gradle/2.2.3/gradle-2.2.3.pom'. Received status code 407 from server: 
 Proxy Authentication Required
Run Code Online (Sandbox Code Playgroud)

当我试图跑

直接在Android Studio中

我明白了:

Error:Could not GET 
'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-
2.2.3.pom'. …
Run Code Online (Sandbox Code Playgroud)

android android-gradle-plugin react-native

7
推荐指数
1
解决办法
1594
查看次数

什么是“禁用离线模式”和“禁用 gradle 离线”模式以及 Android Studio 4.1 中的此设置

我在 Android 4.1 版本和代理后面。我已经设置了代理设置并且 sdk 下载工作正常。但是当我创建一个新项目时,它抛出错误:

Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'. Received status code 407 from server: Proxy Authentication Required
Run Code Online (Sandbox Code Playgroud)

禁用 Gradle 的“离线模式”并同步项目

在设置中搜索 Gradle Offline 时,我发现以下快照:

Android Studio 设置中没有 Gradle 离线设置

我只是点击了网址,然后错误来了“禁用离线模式”

两者之间有什么区别,它们可以在最新的 Android Studio 中找到。我记得在较旧的 Android Studio 版本的设置中使用搜索很容易找到它,但不是这个。

android gradle android-studio-4.1

7
推荐指数
2
解决办法
2万
查看次数

Android Studio - 无法下载sdk-common.jar

我正在尝试学习Android编程.我安装了Android Studio并安装了28 - 24的SDK.然后我启动了一个新项目并将最低级别设置为26.只要Android Studio创建项目,它就会尝试构建项目并立即显示以下错误:

Error:Could not download sdk-common.jar (com.android.tools:sdk-common:26.1.4):
    No cached version available for offline mode
Run Code Online (Sandbox Code Playgroud)

我试过搜索但没有找到任何解决方案.
我怎样才能解决这个问题?谢谢.

android

5
推荐指数
1
解决办法
1419
查看次数

我们如何在 Android Studio 中禁用离线模式?

我们如何从其 UI 中禁用 Android Studio 的离线模式?

在此处输入图片说明

android offline

1
推荐指数
1
解决办法
3009
查看次数