草庐IT

Android SDK Manager 无法下载新文件

coder 2023-11-28 原文

我试图获取最新的 android 源代码(5.0,只是为了看看它的外观),但是当我尝试从 Android SDK 下载源代码时,它给了我一个错误,说 local 未找到 URL。这是日志:

Fetching https://dl-ssl.google.com/android/repository/addons_list-2.xml
Validate XML
Parse XML
Fetched Add-ons List successfully
Fetching URL: https://dl-ssl.google.com/android/repository/repository-10.xml
Validate XML: https://dl-ssl.google.com/android/repository/repository-10.xml
Parse XML:    https://dl-ssl.google.com/android/repository/repository-10.xml
  Found SDK Platform Android 1.1, API 2, revision 1 (Obsolete)
  Found SDK Platform Android 1.5, API 3, revision 4
  Found SDK Platform Android 1.6, API 4, revision 3
  Found SDK Platform Android 2.0, API 5, revision 1 (Obsolete)
  Found SDK Platform Android 2.0.1, API 6, revision 1 (Obsolete)
  Found SDK Platform Android 2.1, API 7, revision 3
  Found SDK Platform Android 2.2, API 8, revision 3
  Found SDK Platform Android 2.3.1, API 9, revision 2 (Obsolete)
  Found SDK Platform Android 2.3.3, API 10, revision 2
  Found SDK Platform Android 3.0, API 11, revision 2
  Found SDK Platform Android 3.1, API 12, revision 3
  Found SDK Platform Android 3.2, API 13, revision 1
  Found SDK Platform Android 4.0, API 14, revision 4
  Found SDK Platform Android 4.0.3, API 15, revision 5
  Found SDK Platform Android 4.1.2, API 16, revision 5
  Found SDK Platform Android 4.2.2, API 17, revision 3
  Found SDK Platform Android 4.3.1, API 18, revision 3
  Found SDK Platform Android 4.4.2, API 19, revision 4
  Found SDK Platform Android 4.4W.2, API 20, revision 2
  Found SDK Platform Android 5.0.1, API 21, revision 2
  Found Samples for SDK API 7, revision 1
  Found Samples for SDK API 8, revision 1
  Found Samples for SDK API 9, revision 1 (Obsolete)
  Found Samples for SDK API 10, revision 1
  Found Samples for SDK API 11, revision 1
  Found Samples for SDK API 12, revision 1
  Found Samples for SDK API 13, revision 1
  Found Samples for SDK API 14, revision 2
  Found Samples for SDK API 15, revision 2
  Found Samples for SDK API 16, revision 1
  Found Samples for SDK API 17, revision 1
  Found Samples for SDK API 18, revision 1
  Found Samples for SDK API 19, revision 6
  Found Samples for SDK API 20, revision 3
  Found Samples for SDK API 21, revision 4
  Found Android SDK Platform-tools, revision 21
  Found Android SDK Build-tools, revision 17
  Found Android SDK Build-tools, revision 18.0.1
  Found Android SDK Build-tools, revision 18.1
  Found Android SDK Build-tools, revision 18.1.1
  Found Android SDK Build-tools, revision 19
  Found Android SDK Build-tools, revision 19.0.1
  Found Android SDK Build-tools, revision 19.0.2
  Found Android SDK Build-tools, revision 19.0.3
  Found Android SDK Build-tools, revision 19.1
  Found Android SDK Build-tools, revision 20
  Found Android SDK Build-tools, revision 21
  Found Android SDK Build-tools, revision 21.0.1
  Found Android SDK Build-tools, revision 21.0.2
  Found Android SDK Build-tools, revision 21.1
  Found Android SDK Build-tools, revision 21.1.1
  Found Android SDK Build-tools, revision 21.1.2
  Found Android SDK Tools, revision 24.0.2
  Found Documentation for Android SDK, API 21, revision 1
  Found Sources for Android SDK, API 14, revision 1
  Found Sources for Android SDK, API 15, revision 2
  Found Sources for Android SDK, API 16, revision 2
  Found Sources for Android SDK, API 17, revision 1
  Found Sources for Android SDK, API 18, revision 1
  Found Sources for Android SDK, API 19, revision 2
  Found Sources for Android SDK, API 20, revision 1
  Found Sources for Android SDK, API 21, revision 1
Fetching URL: https://dl-ssl.google.com/android/repository/addon.xml
Validate XML: https://dl-ssl.google.com/android/repository/addon.xml
Parse XML:    https://dl-ssl.google.com/android/repository/addon.xml
  Found Google APIs, Android API 3, revision 3
  Found Google APIs, Android API 4, revision 2
  Found Google APIs, Android API 5, revision 1 (Obsolete)
  Found Google APIs, Android API 6, revision 1 (Obsolete)
  Found Google APIs, Android API 7, revision 1
  Found Google APIs, Android API 8, revision 2
  Found Google APIs, Android API 9, revision 2 (Obsolete)
  Found Google APIs, Android API 10, revision 2
  Found Google APIs, Android API 11, revision 1
  Found Google APIs, Android API 12, revision 1
  Found Google APIs, Android API 13, revision 1
  Found Google APIs, Android API 14, revision 2
  Found Google APIs, Android API 15, revision 2
  Found Google APIs, Android API 16, revision 3
  Found Google APIs, Android API 17, revision 3
  Found Google APIs, Android API 18, revision 3
  Found Google APIs (ARM System Image), Android API 19, revision 10
  Found Google APIs, Android API 21, revision 1
  Found Google TV Addon, Android API 12, revision 2
  Found Google TV Addon, Android API 13, revision 1
  Found Android Support Library, revision 21.0.3
  Found Android Support Repository, revision 11
  Found Google Repository, revision 15
  Found Google Play Licensing Library, revision 2
  Found Google Play APK Expansion Library, revision 3
  Found Google Play services for Froyo, revision 12
  Found Google Play services, revision 22
  Found Google USB Driver, revision 11
  Found Google Play Billing Library, revision 5
  Found Google AdMob Ads SDK, revision 11 (Obsolete)
  Found Google Analytics App Tracking SDK, revision 3 (Obsolete)
  Found Google Web Driver, revision 2
  Found Google Cloud Messaging for Android Library, revision 3 (Obsolete)
  Found Android Auto API Simulators, revision 1
Fetching URL: https://dl-ssl.google.com/android/repository/addon-6.xml
Validate XML: https://dl-ssl.google.com/android/repository/addon-6.xml
Parse XML:    https://dl-ssl.google.com/android/repository/addon-6.xml
  Found Android Support Library, revision 19.1
Fetching URL: https://dl-ssl.google.com/glass/gdk/addon.xml
Validate XML: https://dl-ssl.google.com/glass/gdk/addon.xml
Parse XML:    https://dl-ssl.google.com/glass/gdk/addon.xml
  Found Glass Development Kit Preview, Android API 19, revision 11
Fetching URL: https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
Validate XML: https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
Parse XML:    https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
  Found Intel x86 Emulator Accelerator (HAXM installer), revision 5.2
Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
  Found ARM EABI v7a System Image, Android API 14, revision 2
  Found ARM EABI v7a System Image, Android API 15, revision 2
  Found ARM EABI v7a System Image, Android API 16, revision 3
  Found ARM EABI v7a System Image, Android API 17, revision 2
  Found ARM EABI v7a System Image, Android API 18, revision 2
  Found ARM EABI v7a System Image, Android API 19, revision 2
  Found ARM EABI v7a System Image, Android API 21, revision 1
  Found Intel x86 Atom System Image, Android API 10, revision 2
  Found Intel x86 Atom System Image, Android API 15, revision 1
  Found Intel x86 Atom System Image, Android API 16, revision 1
  Found Intel x86 Atom System Image, Android API 17, revision 1
  Found Intel x86 Atom System Image, Android API 18, revision 1
  Found Intel x86 Atom System Image, Android API 19, revision 2
  Found Intel x86 Atom System Image, Android API 21, revision 1
  Found Intel x86 Atom_64 System Image, Android API 21, revision 1
  Found MIPS System Image, Android API 15, revision 1
  Found MIPS System Image, Android API 16, revision 4
  Found MIPS System Image, Android API 17, revision 1
Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Found Android Wear ARM EABI v7a System Image, Android API 20, revision 4
  Found Android Wear Intel x86 Atom System Image, Android API 20, revision 4
  Found Android Wear ARM EABI v7a System Image, Android API 21, revision 1
  Found Android Wear Intel x86 Atom System Image, Android API 21, revision 1
Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Found Android TV Intel x86 Atom System Image, Android API 21, revision 1
  Found Android TV ARM EABI v7a System Image, Android API 21, revision 1
Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/google_apis/sys-img.xml
Validate XML: https://dl-ssl.google.com/android/repository/sys-img/google_apis/sys-img.xml
Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/google_apis/sys-img.xml
  Found Google APIs Intel x86 Atom System Image, Google Inc. API 21, revision 3
  Found Google APIs Intel x86 Atom_64 System Image, Google Inc. API 21, revision 3
  Found Google APIs ARM EABI v7a System Image, Google Inc. API 21, revision 3
Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
Validate XML: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
  Found Google APIs (x86 System Image), Android API 19, revision 10
Done loading packages.
Fetching https://dl-ssl.google.com/android/repository/addons_list-2.xml
Validate XML
Parse XML
Fetched Add-ons List successfully
Fetching URL: https://dl-ssl.google.com/android/repository/repository-10.xml
Validate XML: https://dl-ssl.google.com/android/repository/repository-10.xml
Parse XML:    https://dl-ssl.google.com/android/repository/repository-10.xml
  Found SDK Platform Android 1.1, API 2, revision 1 (Obsolete)
  Found SDK Platform Android 1.5, API 3, revision 4
  Found SDK Platform Android 1.6, API 4, revision 3
  Found SDK Platform Android 2.0, API 5, revision 1 (Obsolete)
  Found SDK Platform Android 2.0.1, API 6, revision 1 (Obsolete)
  Found SDK Platform Android 2.1, API 7, revision 3
  Found SDK Platform Android 2.2, API 8, revision 3
  Found SDK Platform Android 2.3.1, API 9, revision 2 (Obsolete)
  Found SDK Platform Android 2.3.3, API 10, revision 2
  Found SDK Platform Android 3.0, API 11, revision 2
  Found SDK Platform Android 3.1, API 12, revision 3
  Found SDK Platform Android 3.2, API 13, revision 1
  Found SDK Platform Android 4.0, API 14, revision 4
  Found SDK Platform Android 4.0.3, API 15, revision 5
  Found SDK Platform Android 4.1.2, API 16, revision 5
  Found SDK Platform Android 4.2.2, API 17, revision 3
  Found SDK Platform Android 4.3.1, API 18, revision 3
  Found SDK Platform Android 4.4.2, API 19, revision 4
  Found SDK Platform Android 4.4W.2, API 20, revision 2
  Found SDK Platform Android 5.0.1, API 21, revision 2
  Found Samples for SDK API 7, revision 1
  Found Samples for SDK API 8, revision 1
  Found Samples for SDK API 9, revision 1 (Obsolete)
  Found Samples for SDK API 10, revision 1
  Found Samples for SDK API 11, revision 1
  Found Samples for SDK API 12, revision 1
  Found Samples for SDK API 13, revision 1
  Found Samples for SDK API 14, revision 2
  Found Samples for SDK API 15, revision 2
  Found Samples for SDK API 16, revision 1
  Found Samples for SDK API 17, revision 1
  Found Samples for SDK API 18, revision 1
  Found Samples for SDK API 19, revision 6
  Found Samples for SDK API 20, revision 3
  Found Samples for SDK API 21, revision 4
  Found Android SDK Platform-tools, revision 21
  Found Android SDK Build-tools, revision 17
  Found Android SDK Build-tools, revision 18.0.1
  Found Android SDK Build-tools, revision 18.1
  Found Android SDK Build-tools, revision 18.1.1
  Found Android SDK Build-tools, revision 19
  Found Android SDK Build-tools, revision 19.0.1
  Found Android SDK Build-tools, revision 19.0.2
  Found Android SDK Build-tools, revision 19.0.3
  Found Android SDK Build-tools, revision 19.1
  Found Android SDK Build-tools, revision 20
  Found Android SDK Build-tools, revision 21
  Found Android SDK Build-tools, revision 21.0.1
  Found Android SDK Build-tools, revision 21.0.2
  Found Android SDK Build-tools, revision 21.1
  Found Android SDK Build-tools, revision 21.1.1
  Found Android SDK Build-tools, revision 21.1.2
  Found Android SDK Tools, revision 24.0.2
  Found Documentation for Android SDK, API 21, revision 1
  Found Sources for Android SDK, API 14, revision 1
  Found Sources for Android SDK, API 15, revision 2
  Found Sources for Android SDK, API 16, revision 2
  Found Sources for Android SDK, API 17, revision 1
  Found Sources for Android SDK, API 18, revision 1
  Found Sources for Android SDK, API 19, revision 2
  Found Sources for Android SDK, API 20, revision 1
  Found Sources for Android SDK, API 21, revision 1
Fetching URL: https://dl-ssl.google.com/android/repository/addon.xml
Validate XML: https://dl-ssl.google.com/android/repository/addon.xml
Parse XML:    https://dl-ssl.google.com/android/repository/addon.xml
  Found Google APIs, Android API 3, revision 3
  Found Google APIs, Android API 4, revision 2
  Found Google APIs, Android API 5, revision 1 (Obsolete)
  Found Google APIs, Android API 6, revision 1 (Obsolete)
  Found Google APIs, Android API 7, revision 1
  Found Google APIs, Android API 8, revision 2
  Found Google APIs, Android API 9, revision 2 (Obsolete)
  Found Google APIs, Android API 10, revision 2
  Found Google APIs, Android API 11, revision 1
  Found Google APIs, Android API 12, revision 1
  Found Google APIs, Android API 13, revision 1
  Found Google APIs, Android API 14, revision 2
  Found Google APIs, Android API 15, revision 2
  Found Google APIs, Android API 16, revision 3
  Found Google APIs, Android API 17, revision 3
  Found Google APIs, Android API 18, revision 3
  Found Google APIs (ARM System Image), Android API 19, revision 10
  Found Google APIs, Android API 21, revision 1
  Found Google TV Addon, Android API 12, revision 2
  Found Google TV Addon, Android API 13, revision 1
  Found Android Support Library, revision 21.0.3
  Found Android Support Repository, revision 11
  Found Google Repository, revision 15
  Found Google Play Licensing Library, revision 2
  Found Google Play APK Expansion Library, revision 3
  Found Google Play services for Froyo, revision 12
  Found Google Play services, revision 22
  Found Google USB Driver, revision 11
  Found Google Play Billing Library, revision 5
  Found Google AdMob Ads SDK, revision 11 (Obsolete)
  Found Google Analytics App Tracking SDK, revision 3 (Obsolete)
  Found Google Web Driver, revision 2
  Found Google Cloud Messaging for Android Library, revision 3 (Obsolete)
  Found Android Auto API Simulators, revision 1
Fetching URL: https://dl-ssl.google.com/android/repository/addon-6.xml
Validate XML: https://dl-ssl.google.com/android/repository/addon-6.xml
Parse XML:    https://dl-ssl.google.com/android/repository/addon-6.xml
  Found Android Support Library, revision 19.1
Fetching URL: https://dl-ssl.google.com/glass/gdk/addon.xml
Validate XML: https://dl-ssl.google.com/glass/gdk/addon.xml
Parse XML:    https://dl-ssl.google.com/glass/gdk/addon.xml
  Found Glass Development Kit Preview, Android API 19, revision 11
Fetching URL: https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
Validate XML: https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
Parse XML:    https://dl-ssl.google.com/android/repository/extras/intel/addon.xml
  Found Intel x86 Emulator Accelerator (HAXM installer), revision 5.2
Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/android/sys-img.xml
  Found ARM EABI v7a System Image, Android API 14, revision 2
  Found ARM EABI v7a System Image, Android API 15, revision 2
  Found ARM EABI v7a System Image, Android API 16, revision 3
  Found ARM EABI v7a System Image, Android API 17, revision 2
  Found ARM EABI v7a System Image, Android API 18, revision 2
  Found ARM EABI v7a System Image, Android API 19, revision 2
  Found ARM EABI v7a System Image, Android API 21, revision 1
  Found Intel x86 Atom System Image, Android API 10, revision 2
  Found Intel x86 Atom System Image, Android API 15, revision 1
  Found Intel x86 Atom System Image, Android API 16, revision 1
  Found Intel x86 Atom System Image, Android API 17, revision 1
  Found Intel x86 Atom System Image, Android API 18, revision 1
  Found Intel x86 Atom System Image, Android API 19, revision 2
  Found Intel x86 Atom System Image, Android API 21, revision 1
  Found Intel x86 Atom_64 System Image, Android API 21, revision 1
  Found MIPS System Image, Android API 15, revision 1
  Found MIPS System Image, Android API 16, revision 4
  Found MIPS System Image, Android API 17, revision 1
Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Found Android Wear ARM EABI v7a System Image, Android API 20, revision 4
  Found Android Wear Intel x86 Atom System Image, Android API 20, revision 4
  Found Android Wear ARM EABI v7a System Image, Android API 21, revision 1
  Found Android Wear Intel x86 Atom System Image, Android API 21, revision 1
Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
Validate XML: https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Found Android TV Intel x86 Atom System Image, Android API 21, revision 1
  Found Android TV ARM EABI v7a System Image, Android API 21, revision 1
Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/google_apis/sys-img.xml
Validate XML: https://dl-ssl.google.com/android/repository/sys-img/google_apis/sys-img.xml
Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/google_apis/sys-img.xml
  Found Google APIs Intel x86 Atom System Image, Google Inc. API 21, revision 3
  Found Google APIs Intel x86 Atom_64 System Image, Google Inc. API 21, revision 3
  Found Google APIs ARM EABI v7a System Image, Google Inc. API 21, revision 3
Fetching URL: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
Validate XML: https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
Parse XML:    https://dl-ssl.google.com/android/repository/sys-img/x86/addon-x86.xml
  Found Google APIs (x86 System Image), Android API 19, revision 10
Done loading packages.
Preparing to install archives
Downloading Android SDK Tools, revision 24.0.2
URL not found: C:\Program Files (x86)\Android\android-sdk\temp\tools_r24.0.2-windows.zip (Access is denied)
Downloading Android SDK Platform-tools, revision 21
URL not found: C:\Program Files (x86)\Android\android-sdk\temp\platform-tools_r21-windows.zip (Access is denied)
Downloading Documentation for Android SDK, API 21, revision 1
URL not found: C:\Program Files (x86)\Android\android-sdk\temp\docs-21_r01.zip (Access is denied)
Downloading SDK Platform Android 5.0.1, API 21, revision 2
URL not found: C:\Program Files (x86)\Android\android-sdk\temp\android-21_r02.zip (Access is denied)
Downloading Samples for SDK API 21, revision 4
URL not found: C:\Program Files (x86)\Android\android-sdk\temp\samples-21_r04.zip (Access is denied)
Downloading Sources for Android SDK, API 21, revision 1
URL not found: C:\Program Files (x86)\Android\android-sdk\temp\sources-21_r01.zip (Access is denied)
Downloading Android Support Library, revision 21.0.3
URL not found: C:\Program Files (x86)\Android\android-sdk\temp\support_r21.0.3.zip (Access is denied)
Skipping 'Android TV ARM EABI v7a System Image, Android API 21, revision 1'; it depends on 'SDK Platform Android 5.0.1, API 21, revision 2' which was not installed.
Skipping 'Android TV Intel x86 Atom System Image, Android API 21, revision 1'; it depends on 'SDK Platform Android 5.0.1, API 21, revision 2' which was not installed.
Skipping 'Android Wear ARM EABI v7a System Image, Android API 21, revision 1'; it depends on 'SDK Platform Android 5.0.1, API 21, revision 2' which was not installed.
Skipping 'Android Wear Intel x86 Atom System Image, Android API 21, revision 1'; it depends on 'SDK Platform Android 5.0.1, API 21, revision 2' which was not installed.
Skipping 'ARM EABI v7a System Image, Android API 21, revision 1'; it depends on 'SDK Platform Android 5.0.1, API 21, revision 2' which was not installed.
Skipping 'Intel x86 Atom_64 System Image, Android API 21, revision 1'; it depends on 'SDK Platform Android 5.0.1, API 21, revision 2' which was not installed.
Skipping 'Intel x86 Atom System Image, Android API 21, revision 1'; it depends on 'SDK Platform Android 5.0.1, API 21, revision 2' which was not installed.
Skipping 'Google APIs ARM EABI v7a System Image, Google Inc. API 21, revision 3'; it depends on 'SDK Platform Android 5.0.1, API 21, revision 2' which was not installed.
Skipping 'Google APIs Intel x86 Atom_64 System Image, Google Inc. API 21, revision 3'; it depends on 'SDK Platform Android 5.0.1, API 21, revision 2' which was not installed.
Skipping 'Google APIs Intel x86 Atom System Image, Google Inc. API 21, revision 3'; it depends on 'SDK Platform Android 5.0.1, API 21, revision 2' which was not installed.
Skipping 'Google APIs, Android API 21, revision 1'; it depends on 'SDK Platform Android 5.0.1, API 21, revision 2' which was not installed.
Done. Nothing was installed.

我不明白这个问题,但我想了解发生了什么以及如何解决它。

--编辑-- 我忘了说:我在 Windows 8.1 上使用 Android Studio。

最佳答案

尝试使用管理员权限/帐户执行您的 sdk 管理器。 似乎该文件存在,即使它说找不到 URL,它只是无法访问它,因为 sdk 管理器的权限不够高。

未找到 URL:C:\Program Files (x86)\Android\android-sdk\temp\tools_r24.0.2-windows.zip (访问被拒绝)

每一行都一样,所以这可能只是一个版权问题。

关于Android SDK Manager 无法下载新文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27829942/

有关Android SDK Manager 无法下载新文件的更多相关文章

  1. ruby - 使用 RubyZip 生成 ZIP 文件时设置压缩级别 - 2

    我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看ruby​​zip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d

  2. ruby - 其他文件中的 Rake 任务 - 2

    我试图在一个项目中使用rake,如果我把所有东西都放到Rakefile中,它会很大并且很难读取/找到东西,所以我试着将每个命名空间放在lib/rake中它自己的文件中,我添加了这个到我的rake文件的顶部:Dir['#{File.dirname(__FILE__)}/lib/rake/*.rake'].map{|f|requiref}它加载文件没问题,但没有任务。我现在只有一个.rake文件作为测试,名为“servers.rake”,它看起来像这样:namespace:serverdotask:testdoputs"test"endend所以当我运行rakeserver:testid时

  3. ruby-on-rails - 在 Rails 中将文件大小字符串转换为等效千字节 - 2

    我的目标是转换表单输入,例如“100兆字节”或“1GB”,并将其转换为我可以存储在数据库中的文件大小(以千字节为单位)。目前,我有这个:defquota_convert@regex=/([0-9]+)(.*)s/@sizes=%w{kilobytemegabytegigabyte}m=self.quota.match(@regex)if@sizes.include?m[2]eval("self.quota=#{m[1]}.#{m[2]}")endend这有效,但前提是输入是倍数(“gigabytes”,而不是“gigabyte”)并且由于使用了eval看起来疯狂不安全。所以,功能正常,

  4. ruby-on-rails - 由于 "wkhtmltopdf",PDFKIT 显然无法正常工作 - 2

    我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-

  5. ruby-on-rails - Rails 3 中的多个路由文件 - 2

    Rails2.3可以选择随时使用RouteSet#add_configuration_file添加更多路由。是否可以在Rails3项目中做同样的事情? 最佳答案 在config/application.rb中:config.paths.config.routes在Rails3.2(也可能是Rails3.1)中,使用:config.paths["config/routes"] 关于ruby-on-rails-Rails3中的多个路由文件,我们在StackOverflow上找到一个类似的问题

  6. ruby - 将差异补丁应用于字符串/文件 - 2

    对于具有离线功能的智能手机应用程序,我正在为Xml文件创建单向文本同步。我希望我的服务器将增量/差异(例如GNU差异补丁)发送到目标设备。这是计划:Time=0Server:hasversion_1ofXmlfile(~800kiB)Client:hasversion_1ofXmlfile(~800kiB)Time=1Server:hasversion_1andversion_2ofXmlfile(each~800kiB)computesdeltaoftheseversions(=patch)(~10kiB)sendspatchtoClient(~10kiBtransferred)Cl

  7. ruby - 如何将脚本文件的末尾读取为数据文件(Perl 或任何其他语言) - 2

    我正在寻找执行以下操作的正确语法(在Perl、Shell或Ruby中):#variabletoaccessthedatalinesappendedasafileEND_OF_SCRIPT_MARKERrawdatastartshereanditcontinues. 最佳答案 Perl用__DATA__做这个:#!/usr/bin/perlusestrict;usewarnings;while(){print;}__DATA__Texttoprintgoeshere 关于ruby-如何将脚

  8. ruby - 使用 Vim Rails,您可以创建一个新的迁移文件并一次性打开它吗? - 2

    使用带有Rails插件的vim,您可以创建一个迁移文件,然后一次性打开该文件吗?textmate也可以这样吗? 最佳答案 你可以使用rails.vim然后做类似的事情::Rgeneratemigratonadd_foo_to_bar插件将打开迁移生成的文件,这正是您想要的。我不能代表textmate。 关于ruby-使用VimRails,您可以创建一个新的迁移文件并一次性打开它吗?,我们在StackOverflow上找到一个类似的问题: https://sta

  9. ruby-on-rails - 无法使用 Rails 3.2 创建插件? - 2

    我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby​​1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在

  10. ruby - 无法运行 Rails 2.x 应用程序 - 2

    我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby​​:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r

随机推荐