我正在引导一个 Android 项目,它似乎是用 Gradle 管理的。
老实说,我是 Gradle 的新手,所以我正在慢慢准备。
这是我的 gradle 包装器的输出:
C:\Users\Daniel\Projects\JustSingIt-Android [feature/no-newrelic +0 ~1 -0]> .\gradlew --info
Starting Build
Settings evaluated using settings file 'C:\Users\Daniel\Projects\JustSingIt- Android\settings.gradle'.
Projects loaded. Root project using build file 'C:\Users\Daniel\Projects\JustSingIt-Android\build.gradle'.
Included projects: [root project 'JustSingIt-Android', project ':JustSingIt']
Evaluating root project 'JustSingIt-Android' using build file 'C:\Users\Daniel\Projects\JustSingIt-Android\build.grad'.
Evaluating project ':JustSingIt' using build file 'C:\Users\Daniel\Projects\JustSingIt-Android\JustSingIt\build.gradl'
Compiling build file 'C:\Users\Daniel\Projects\JustSingIt- Android\JustSingIt\build.gradle' using BuildScriptClasspathiptTransformer.
Compiling build file 'C:\Users\Daniel\Projects\JustSingIt-Android\JustSingIt\build.gradle' using BuildScriptTransform
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed Gradle 2.0
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/volley/volley/1.0/volley-1.0.pom]
Resource missing. [HTTP HEAD: http://repo1.maven.org/maven2/com/android/volley/volley/1.0/volley-1.0.jar]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/readystatesoftware/android-simpl3r/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/readystatesoftware/android-simpl3r/]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/readystatesoftware/android-simpl3r/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/readystatesoftware/android-simpl3r/]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/handmark/pulltorefresh/library/2.1.1/library-2.1.1.pom
Resource missing. [HTTP HEAD: http://repo1.maven.org/maven2/com/handmark/pulltorefresh/library/2.1.1/library-2.1.1.ja
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/facebook/android/facebook-sdk/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/facebook/android/facebook-sdk/]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/facebook/android/facebook-sdk/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/facebook/android/facebook-sdk/]
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':JustSingIt'.
> Could not resolve all dependencies for configuration ':JustSingIt:_debugCompile'.
> Could not find com.android.volley:volley:1.0.
Required by:
JustSingIt-Android:JustSingIt:unspecified
> Could not find any version that matches com.readystatesoftware:android-simpl3r:1.0+.
Required by:
JustSingIt-Android:JustSingIt:unspecified
> Could not find com.handmark.pulltorefresh:library:2.1.1.
Required by:
JustSingIt-Android:JustSingIt:unspecified
> Could not find any version that matches com.facebook.android:facebook-sdk:0.1+.
Required by:
JustSingIt-Android:JustSingIt:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
这是我的 gradle 文件:
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7+'
classpath 'com.newrelic.agent.android:agent-gradle-plugin:2.433.0'
}
}
apply plugin: 'android'
//apply plugin: 'newrelic'
repositories {
mavenCentral()
mavenLocal()
}
android {
compileSdkVersion 18
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
buildConfigField "boolean", "ACRA_ENABLE", 'true'
buildConfigField "boolean", "API_FAKE_ENABLE", 'true'
}
buildTypes {
stage {
versionName
versionNameSuffix 'S'
debuggable true
packageNameSuffix '.stage'
}
dev {
versionNameSuffix 'D'
debuggable true
packageNameSuffix '.dev'
}
release {
debuggable true
}
}
dependencies {
repositories()
compile fileTree(dir: 'libs', include: '*.jar')
// Google Play Services
compile 'com.google.android.gms:play-services:3.2+'
compile 'com.android.volley:volley:1.0'
compile 'com.squareup:otto:1.3+'
compile('com.google.code.gson:gson:2.2+') {
exclude group: 'org.json'
}
compile 'com.googlecode.libphonenumber:libphonenumber:3.1+'
compile 'ch.acra:acra:4.5+'
compile 'com.squareup.okhttp:okhttp:1.2+'
compile 'com.jakewharton:butterknife:3.0+'
compile 'com.android.support:appcompat-v7:18.0.0'
compile 'com.readystatesoftware:android-simpl3r:1.0+'
// New Relic removed.
// compile 'com.newrelic.agent.android:android-agent:2.433.0'
// compile 'com.origamilabs.library:StaggeredGridView:1.0+'
compile 'net.hockeyapp.android:HockeySDK:3.0.1'
compile("com.handmark.pulltorefresh:library:2.1.1") {
exclude group: 'com.android.support'
}
compile('com.facebook.android:facebook-sdk:0.1+') {
exclude group: 'com.android.support'
}
}
}
有什么想法吗?谢谢!
编辑:新问题
好的,现在的问题是,在构建 (.\gradlew build) 期间,我遇到了很多与类路径中未找到的库相关的错误。我还手动将 Amazon AWS SDK 添加到项目中,但我遇到了同样的错误。唯一似乎正确安装的库是 Facebook。
这是我最新的 build.gradle:
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7+'
classpath 'com.newrelic.agent.android:agent-gradle-plugin:2.433.0'
}
}
apply plugin: 'android'
//apply plugin: 'newrelic'
repositories {
mavenCentral()
mavenLocal()
}
android {
compileSdkVersion 18
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
buildConfigField "boolean", "ACRA_ENABLE", 'true'
buildConfigField "boolean", "API_FAKE_ENABLE", 'true'
}
buildTypes {
stage {
versionName
versionNameSuffix 'S'
debuggable true
packageNameSuffix '.stage'
}
dev {
versionNameSuffix 'D'
debuggable true
packageNameSuffix '.dev'
}
release {
debuggable true
}
}
dependencies {
repositories()
compile fileTree(dir: 'libs', include: '*.jar')
compile fileTree(dir: 'libraries', include: '*.jar')
compile project(':libraries:facebook')
compile 'com.google.android.gms:play-services:3.2+' // Google Play Services
compile 'com.mcxiaoke.volley:library:1.0+' // <- Volley-Mirror, a mirror of volley,
compile 'com.squareup:otto:1.3+'
compile 'com.googlecode.libphonenumber:libphonenumber:3.1+'
compile 'ch.acra:acra:4.5+'
compile 'com.squareup.okhttp:okhttp:1.2+'
compile 'com.jakewharton:butterknife:3.0+'
compile 'com.android.support:appcompat-v7:18.0.0'
compile 'com.github.manuelpeinado.refreshactionitem:library:1.0+'
compile 'net.hockeyapp.android:HockeySDK:3.0.1'
compile('com.google.code.gson:gson:2.2+') {
exclude group: 'org.json'
}
compile('com.github.chrisbanes.pulltorefresh:parent:2.1+') {
exclude group: 'com.android.support'
}
// New Relic removed.
// compile 'com.newrelic.agent.android:android-agent:2.433.0'
// compile 'com.origamilabs.library:StaggeredGridView:1.0+'
// compile('com.facebook.android:facebook-sdk:0.1+') {
// exclude group: 'com.android.support'
// }
}
}
最佳答案
并非每个库都在 Maven 中央存储库中可用。有时您必须将其他存储库添加到您的构建或自己构建项目并发布到本地 Maven 存储库。
com.android.volley - 在 Maven Central 中不可用,但您可以自己构建它并推送到本地 Maven 存储库或使用 volley-mirror项目,发布到 Maven Central。
com.facebook.android - 您必须安装它才能在您的项目中使用。提供说明 here .
com.handmark.pulltorefresh - 它在 com.github.chrisbanes.pulltorefresh 下发布到 Maven Central
com.readystatesoftware.android-simpl3r - 同上,发布到 Maven Central com.github.manuelpeinado.refreshactionitem
关于android - Gradle 缺少依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21008095/
我正在尝试修改当前依赖于定义为activeresource的gem:s.add_dependency"activeresource","~>3.0"为了让gem与Rails4一起工作,我需要扩展依赖关系以与activeresource的版本3或4一起工作。我不想简单地添加以下内容,因为它可能会在以后引起问题:s.add_dependency"activeresource",">=3.0"有没有办法指定可接受版本的列表?~>3.0还是~>4.0? 最佳答案 根据thedocumentation,如果你想要3到4之间的所有版本,你可以这
我收到这个错误:RuntimeError(自动加载常量Apps时检测到循环依赖当我使用多线程时。下面是我的代码。为什么会这样?我尝试多线程的原因是因为我正在编写一个HTML抓取应用程序。对Nokogiri::HTML(open())的调用是一个同步阻塞调用,需要1秒才能返回,我有100,000多个页面要访问,所以我试图运行多个线程来解决这个问题。有更好的方法吗?classToolsController0)app.website=array.join(',')putsapp.websiteelseapp.website="NONE"endapp.saveapps=Apps.order("
最近因为项目需要,需要将Android手机系统自带的某个系统软件反编译并更改里面某个资源,并重新打包,签名生成新的自定义的apk,下面我来介绍一下我的实现过程。APK修改,分为以下几步:反编译解包,修改,重打包,修改签名等步骤。安卓apk修改准备工作1.系统配置好JavaJDK环境变量2.需要root权限的手机(针对系统自带apk,其他软件免root)3.Auto-Sign签名工具4.apktool工具安卓apk修改开始反编译本文拿Android系统里面的Settings.apk做demo,具体如何将apk获取出来在此就不过多介绍了,直接进入主题:按键win+R输入cmd,打开命令窗口,并将路
有什么方法可以告诉sidekiq一项工作依赖于另一项工作,并且在后者完成之前无法开始? 最佳答案 仅使用Sidekiq;答案是否定的。正如DickieBoy所建议的那样,您应该能够在依赖作业完成时将其启动。像这样。#app/workers/hard_worker.rbclassHardWorkerincludeSidekiq::Workerdefperform()puts'Doinghardwork'LazyWorker.perform_async()endend#app/workers/lazy_worker.rbclassLaz
如果特定语言环境中缺少翻译,如何配置i18n以使用en语言环境翻译?当前已插入翻译缺失消息。我正在使用RoR3.1。 最佳答案 找到相似的question这里是答案:#application.rb#railswillfallbacktoconfig.i18n.default_localetranslationconfig.i18n.fallbacks=true#railswillfallbacktoen,nomatterwhatissetasconfig.i18n.default_localeconfig.i18n.fallback
目录一.大致如下常见问题:(1)找不到程序所依赖的Qt库version`Qt_5'notfound(requiredby(2)CouldnotLoadtheQtplatformplugin"xcb"in""eventhoughitwasfound(3)打包到在不同的linux系统下,或者打包到高版本的相同系统下,运行程序时,直接提示段错误即segmentationfault,或者Illegalinstruction(coredumped)非法指令(4)ldd应用程序或者库,查看运行所依赖的库时,直接报段错误二.问题逐个分析,得出解决方法:(1)找不到程序所依赖的Qt库version`Qt_5'
代码:threads=[]Thread.abort_on_exception=truebegin#throwexceptionsinthreadssowecanseethemthreadseputs"EXCEPTION:#{e.inspect}"puts"MESSAGE:#{e.message}"end崩溃:.rvm/gems/ruby-2.1.3@req/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:478:inload_missing_constant':自动加载常量MyClass时检测到循环依赖稍加研究后,
我在目录“/home/enterprise/pkg”中有一个本地gem(enterprise-0.0.1.gem)。它依赖于active_directorygem(v1.5.5),这是在它的enterprise.gemspec文件中指定的,如下所示:-gem.add_dependency("active_directory")在我的应用程序的Gemfile中,我添加了以下行:-gem'enterprise','0.0.1',path=>'/home/enterprise/pkg'当我做的时候bundleinstall在我的应用程序的源目录中,只安装了企业gem。因此,我遇到了引用act
我希望Ruby的解析器会进行这种微不足道的优化,但似乎并没有(谈到YARV实现,Ruby1.9.x、2.0.0):require'benchmark'deffib1a,b=0,1whileb由于这两种方法除了在第二种方法中使用预定义常量而不是常量表达式外是相同的,因此Ruby解释器似乎在每个循环中一次又一次地计算幂常数。是否有一些Material说明为什么Ruby根本不进行这种基本优化或只在某些特定情况下进行? 最佳答案 很抱歉给出了另一个答案,但我不想删除或编辑我之前的答案,因为它下面有有趣的讨论。正如JörgWMittag所说,
我有一个依赖于另一个gem的gem(在RubyGems上可用)。那个依赖的gem有一个我最近修复的错误。不幸的是,那个依赖的gem几乎已经死了;它已经很多年没有更新了,而且所有者不再在GitHub上活跃,根本,更不用说提交这个gem了,所以我不希望我的补丁会被接受——肯定不会很快。鉴于此,处理此依赖gem的补丁版本的最佳方法是什么?我是否将它fork并上传一个新的gem(使用新名称)到RubyGems,并依赖它?我是否以某种方式将我的固定版本与我自己的gem打包在一起? 最佳答案 首先,检查有问题的gem的许可证(以及您的代码的许可