gpt4 book ai didi

android - 尝试使用Espresso 2时无法同步Gradle构建

转载 作者:行者123 更新时间:2023-12-03 05:15:03 25 4
gpt4 key购买 nike

我刚刚将androidproject从Eclipse迁移到Android Studio和Gradle。现在,我试图从使用单独的测试项目迁移到使用Gradle和Espresso 2,但是我一直遇到相同的问题。添加espresso2依赖项后,构建将无法完成。我不断收到samme错误消息:

eror

谁能指出我这个问题的解决方案。我已经搜索了两天的解决方案,但没有任何效果。

我的依赖:

dependencies {
// App's dependencies, including test
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:support-annotations:23.1.0'
compile 'com.google.guava:guava:18.0'

// Testing-only dependencies
// Force usage of support annotations in the test app, since it is internally used by the runner module.
androidTestCompile 'com.android.support:support-annotations:23.1.0'
// Android JUnit Runner
androidTestCompile 'com.android.support.test:runner:0.4.1'
// JUnit4 Rules
androidTestCompile 'com.android.support.test:rules:0.4.1'
// Set this dependency to build and run Espresso tests
// Espresso core
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
// Espresso-contrib for DatePicker, RecyclerView, Drawer actions, Accessibility checks, CountingIdlingResource
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.1'
// Set this dependency to build and run UI Automator tests
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
}

有关错误的更多信息:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugAndroidTestCompile'.
> Could not resolve com.squareup:javawriter:2.1.1.
Required by: appName:app:unspecified > com.android.support.test.espresso:espresso- core:2.2.1
> Could not parse POM https://jcenter.bintray.com/com/squareup/javawriter/2.1.1/javawriter-2.1.1.pom
> Content is not allowed in prolog.

运行:“.. \ gradlew -q依赖项appName:dependencies --configuration androidTestCompile --stacktrace”
20:43:24.539 [DEBUG]             [org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.ResolvedConfigurationDependencyGraphVisitorourceResolver.java:391)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CacheLockReleasingModuleComponentsRepository$LockReleasingRepositoryAccess$2.run(CacheLockReleasingModuleComponentsRepository.java:65)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:237)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAc cess.java:308)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(D efaultPersistentDirectoryStore.java:114)
at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.longRunning Operation(DefaultCacheFactory.java:179)
at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.longRunn ingOperation(DefaultCacheLockingManager.java:56)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CacheLockReleasingModule ComponentsRepository$LockReleasingRepositoryAccess.resolveComponentMetaData(CacheLockReleasingModuleComponentsRepository.java:63)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRe pository$ResolveAndCacheRepositoryAccess.resolveComponentMetaData(CachingModuleComponentRepository.java:284)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.BaseModuleComponentRepositoryAccess.resolveComponentMetaData(BaseModuleComponentRepositoryAccess.java:38)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.memcache.InMemoryCachedModuleComponentRepository$CachedAccess.resolveComponentMetaData(InMemoryCachedModuleComponentRepository.java:70)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentMetaDataResolveState.process(ComponentMetaDataResolveState.java:70)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentMetaDataResolveState.resolve(ComponentMetaDataResolveState.java:62)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.findBestMatch(RepositoryChainDependencyResolver.java:114)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.findBestMatch(RepositoryChainDependencyResolver.java:97)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.resolve(RepositoryChainDependencyResolver.java:70)
... 98 more
Caused by: org.xml.sax.SAXParseException; systemId: file:/C:/Users/Thomas/.gradle/caches/modules-2/files- 2.1/com.squareup/javawriter/2.1.1/96cec80cd552
3edeb350e3aaede11430cef7be55/javawriter-2.1.1.pom; lineNumber: 2; columnNumber: 1; Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.PomReader.parseToDom(PomReader.java:191)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.PomReader$1.transform(PomReader.java:98)
... 125 more

最佳答案

只需添加正确的依赖项-doh。正如我所说的Gradle新手。

dependencies {

...

androidTestCompile 'com.squareup:javawriter:2.2.1'
}

关于android - 尝试使用Espresso 2时无法同步Gradle构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33588649/

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