当前位置: 首页 > 知识库问答 >
问题:

无法将Gradle for Android更新到2.13.0以使用ProtoBuf

邓夕
2023-03-14

嘿,我正在做一个项目,我试图使用ProtoBuf Gradle插件。一开始,我得到这个问题,因为我目前有Gradle2.10安装,所以我遵循这里的说明,以及一个

根据这一点,Gradle文件被移动到了JCenter,但是当我跟踪URL时,我得到了404的响应。我尝试像这个答案一样更改分发URL,然后使缓存无效并重新启动,但这也没有修复它。我沮丧地删除了。gradle文件夹中的东西(试图清除缓存),但这也不起作用,我也没能把它们拿回来。

https://stackoverflow.com/a/34179425/6421112-Android支持存储库安装良好。

https://stackoverflow.com/a/34749866/6421112

我得到的错误是列在下面,我不得不审查url部分的url。

Error:Could not find com.android.tools.build:gradle:2.13.0. Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/2.13.0/gradle-2.13.0.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/2.13.0/gradle-2.13.0.jar
%jcenter%/android/tools/build/gradle/2.13.0/gradle-2.13.0.pom
%jcenter%/android/tools/build/gradle/2.13.0/gradle-2.13.0.jar Required by:
:MyApplication:unspecified
Required by:
    :BluetoothHeartbeat:unspecified
        at org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult.notFound(DefaultBuildableComponentResolveResult.java:38)
        at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolveModule(RepositoryChainComponentMetaDataResolver.java:88)
        at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolve(RepositoryChainComponentMetaDataResolver.java:59)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.ComponentResolversChain$ComponentMetaDataResolverChain.resolve(ComponentResolversChain.java:80)
        at org.gradle.api.internal.artifacts.ivyservice.clientmodule.ClientModuleResolver.resolve(ClientModuleResolver.java:44)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$ModuleVersionResolveState.resolve(DependencyGraphBuilder.java:560)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$ModuleVersionResolveState.getMetaData(DependencyGraphBuilder.java:570)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$DependencyEdge.calculateTargetConfigurations(DependencyGraphBuilder.java:256)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$DependencyEdge.attachToTargetConfigurations(DependencyGraphBuilder.java:230)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:137)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:75)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultArtifactDependencyResolver$1.execute(DefaultArtifactDependencyResolver.java:88)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultArtifactDependencyResolver$1.execute(DefaultArtifactDependencyResolver.java:78)
        at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
        at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:61)
        at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:39)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultArtifactDependencyResolver.resolve(DefaultArtifactDependencyResolver.java:78)
        at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.run(CacheLockingArtifactDependencyResolver.java:41)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:192)
        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106)
        at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187)
        at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:64)
        at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:39)
        at org.gradle.api.internal.artifacts.ivyservice.DefaultConfigurationResolver.resolve(DefaultConfigurationResolver.java:91)
        at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyConfigurationResolver.resolve(SelfResolvingDependencyConfigurationResolver.java:40)
        at org.gradle.api.internal.artifacts.ivyservice.ShortCircuitEmptyConfigurationResolver.resolve(ShortCircuitEmptyConfigurationResolver.java:52)
        at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.resolve(ErrorHandlingConfigurationResolver.java:43)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveGraphIfRequired(DefaultConfiguration.java:371)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveNow(DefaultConfiguration.java:346)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getResolvedConfiguration(DefaultConfiguration.java:339)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getResolvedConfiguration(Unknown Source)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:664)
        ... 53 more


BUILD FAILED

Total time: 3.89 secs

这是我的构建。gradle(我的应用程序)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.13.0'

        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.7.7'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是另一个构建。Gradle(应用程序):

apply plugin: 'com.android.application'
//applyplugin: 'com.google.protobuf'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.example.MyApplication"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
}

共有1个答案

谢裕
2023-03-14

我自己回答的。原来这个版本的Android插件版本是com.Android.tools.build:gradle:2.1.2。我把它设置为那个,最新的版本下载很好。

 类似资料:
  • 我正在尝试使用注册功能组件中的useState更新组件的状态。当用户输入无效的电子邮件地址并单击“提交”按钮时,以下代码将返回错误消息 我想用这段代码将错误消息设置为formData。 如何将错误消息设置为formData? 这是我的密码:

  • 如果我为它添加了一个maven依赖项,那么它会显示一些其他丢失的工件,在添加了3、4个依赖项后,它开始给出相同的丢失工件的错误,我已经在pom.xml中添加了这些错误 我也更新了我的maven eclipse插件,但似乎没有什么能解决我的问题 编辑:在我更新了我的java maven project maven->Update project之后,它解决了pom.xml的问题,现在它没有显示任何错

  • 当我试图从java向Mongo DB插入记录时,我无法更新静态字段。 在这个过程之后,我无法在数据库中看到地址字段。我知道静电场有问题,但我很困惑

  • 我当前的Gradle插件版本是4.1.2,这个版本可以正常工作,但是当我更新到4.1.3时,我会出现这个错误,无法构建项目:注意:我添加了maven()和jcenter()。

  • 我遇到了非常奇怪的情况。我成功地将Android SDK工具更新到版本22.6.1。现在当我启动ADT(Eclipse)时,它会向我显示一条消息,上面写着以下内容。 当我按下“检查更新”按钮时,Eclipse会显示一条消息,上面写着“未找到更新”消息。如果我通过帮助-检查更新执行此操作,结果相同。 如果我打开Help-Install New Software并选择Developer Tools U

  • 我最近用Android SDK从头开始构建了一个已经存在的应用程序。之前的版本是一个Titanial移动应用程序,我已经使用了与Titanial应用程序相同的密钥库。不同的是,我删除了所有的,这是不必要的,但在Titanium中自动生成的。 当我上传apk时,我从开发人员控制台得到一个错误,我发现这是相当神秘的,我无法更新apk。我猜这与titanium用NDK构建应用程序有关,我没有这方面的经验