小编dan*_*uzz的帖子

Android:我的应用程序太大,并且"无法执行dex:方法ID不在[0,0xffff]:65536"?

我正在尝试将我的应用程序与Box,Dropbox和Google Drive集成.所有这三项服务都需要一些第三方罐子.此外,我的应用程序已经需要一些第三方罐子.现在当我尝试从eclipse运行我的应用程序时,我收到以下错误:

无法执行dex:方法ID不在[0,0xffff]中:65536转换为Dalvik格式失败:无法执行dex:方法ID不在[0,0xffff]中:65536

似乎发生此错误是因为我的应用程序有太多方法.我相当肯定这些方法的大部分来自第三方罐子,所以试图通过简化我的代码来解决这个问题是不现实的.我在网上找到了这两个建议.

  1. 添加dex.force.jumbo=true到project.properties(并使用adt版本21).我这样做但仍然得到错误.

  2. 使用多个dex文件,如下所述:http://android-developers.blogspot.co.il/2011/07/custom-class-loading-in-dalvik.html.这似乎是唯一的选择,但我不明白它在我的情况下是如何适用的.问题是像Drive这样的服务有太多的依赖关系.这个解决方案是否要求我在引用其依赖项时修改Drive源以使用inflection?(这显然不是一种选择).

  3. 使用proguard缩小删除未使用的代码/方法.使用proguard导出我的应用程序确实有效,文档服务集成在> 4.0设备上按预期工作.但是,在2.3设备上进行测试时会抛出classnotfound错误.

所以,我希望就这个问题提出一些建议.选项2是我案例的解决方案吗?我应该考虑另一个解决方案吗?

android dx dalvik

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

在bash中,[[test1 && test2]]与[[test1]] && [[test2]]之间的区别是什么?

在以下两个bash评估中有什么区别(如果有的话):

if [[ -s $file1 && $file1 -nt $file2 ]]; then

if [[ -s $file1 ]] && [[ $file1 -nt $file2 ]]; then
Run Code Online (Sandbox Code Playgroud)

bash

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

如何使用`--multi-dex`选项?

[2013-11-13 18:39:09 - XlApp] Dx 
trouble writing output: Too many method references: 66024; max is 65536.
You may try using --multi-dex option.
References by package:
    13 java.lang
     1 java.lang.reflect
     5 java.util
     1 javax.xml.namespace
    66 org.apache.xmlbeans
    19 org.apache.xmlbeans.impl.values
     1 org.apache.xmlbeans.impl.xb.xmlschema
  2500 org.openxmlformats.schemas.drawingml.x2006.chart
  1430 org.openxmlformats.schemas.drawingml.x2006.chart.impl
  8767 org.openxmlformats.schemas.drawingml.x2006.main
  5258 org.openxmlformats.schemas.drawingml.x2006.main.impl
    86 org.openxmlformats.schemas.drawingml.x2006.picture
    33 org.openxmlformats.schemas.drawingml.x2006.picture.impl
   745 org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing
   417 org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.impl
   230 org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing
   164 org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.impl
   298 org.openxmlformats.schemas.officeDocument.x2006.customProperties
   256 org.openxmlformats.schemas.officeDocument.x2006.customProperties.impl
   617 org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes
   596 org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes.impl
   285 org.openxmlformats.schemas.officeDocument.x2006.extendedProperties
   196 org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.impl
    23 org.openxmlformats.schemas.officeDocument.x2006.math
    24 org.openxmlformats.schemas.officeDocument.x2006.relationships
     2 org.openxmlformats.schemas.officeDocument.x2006.relationships.impl
  2076 org.openxmlformats.schemas.presentationml.x2006.main
  1224 …
Run Code Online (Sandbox Code Playgroud)

android dx dalvik

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

双层"Y型"组合器.这是常见的吗?这有官方名称吗?

我一直在研究禁止使用def-before-def并且没有可变单元格(no set!setq)的语言如何提供递归.我当然跑过(着名的?臭名昭着的?)Y组合者和朋友,例如:

当我以这种方式实现"letrec"语义时(也就是说,允许定义一个局部变量使得它可以是一个递归函数,在封面下它不会引用它自己的名字),组合器我最后写的看起来像这样:

Y_letrec = ?f . (?x.x x) (?s . (?a . (f ((?x.x x) s)) a))
Run Code Online (Sandbox Code Playgroud)

或者,将U组合子分解出来:

U = ?x.x x
Y_letrec = ?f . U (?s . (?a . (f (U s)) a))
Run Code Online (Sandbox Code Playgroud)

读这个:Y_letrec是一个带有待递归函数的函数f. f必须是一个单参数函数,它接受s,可以调用实现自递归s的函数f.f期望定义并返回执行"实际"操作的"内部"函数.该内部函数接受参数a(或者在一般情况下接受参数列表,但不能用传统的表示法表示).调用Y_letrec的结果是调用的结果 f,并且它被假定为"内部"函数,准备被调用.

我这样设置的原因是我可以直接使用待递归函数的解析树形式,而无需修改,只是在处理letrec时转换期间在其周围包裹一个额外的函数层.例如,如果原始代码是:

(letrec ((foo (lambda (a) (foo (cdr a))))))
Run Code Online (Sandbox Code Playgroud)

然后转换后的形式将是:

(define foo (Y_letrec (lambda (foo) (lambda (a) (foo (cdr a))))))
Run Code Online (Sandbox Code Playgroud)

请注意,内部函数体在两者之间是相同的. …

lisp scheme combinators y-combinator anonymous-recursion

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

好奇的tput行为,带有stderr重定向

我正在尝试使用tputBash脚本,并尽力避免随机错误喷出.为此,我写了以下这一行:

COLS="$(tput cols 2> /dev/null)"
Run Code Online (Sandbox Code Playgroud)

令我惊讶的是,当我运行它时,无论我的终端窗口的宽度是多少,COLS都始终设置为80.(为了演示,我的终端恰好是115列宽.)为了弄清楚发生了什么,我在命令行上尝试了一些事情:

$ tput cols
115
$ tput cols | cat
115
$ echo "$(tput cols)"
115
$ tput cols 2> /dev/null
115
$ echo "$(tput cols 2> /dev/null)"
80
Run Code Online (Sandbox Code Playgroud)

因此,tput当它的stderr被重定向时,或者当它被嵌入到进程替换中时,似乎成功地找出终端特性,但不是两者都有.多奇怪啊!

我在Linux和OS X上测试了这个,行为是一样的.

这里发生了什么?而作为一个实际问题,tput在抑制stderr喷射的同时,最好的工作方式是什么?

注意:我知道$COLUMNS.我特别感兴趣的是使用tput.

bash io-redirection

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

存档旧版本的原始Awk源代码?

我正在尝试找到源代码的"历史"版本到原始的Awk(a/k/a One True Awk).我找到了Kernighan偶尔更新的网站,它似乎总是链接到最新版本,但我还没有找到旧版本的缓存.我给Kernighan的邮件(大约一个月前)也没有得到回复,所以我想我会向更广泛的受众广播这个请求.

根据对这个问题的评论,我的资产现在是来自Awk Annoyances页面的2005-04-24 版本,以及2010-2012日期范围内的四个版本由Wayback Machine提供,以及两个版本(2004-02-07和2007) -05-01)通过网络搜索找到awk.tar.gz.

FWIW,我的目的是用尽可能多的版本充实我的One True Awk的公共git回购.


更新2013-04-11:我现在已将我发现的所有版本集成到上述回购中.不过,我仍然希望找到更多来填补空白.

awk history

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

变量传递-v在awk中不起作用

在shell脚本中我试图将变量传递给awk:

说我有

Y=113
Run Code Online (Sandbox Code Playgroud)

我想通过文件(bigfile),如果变量Y在一行上匹配,则打印几列.

如果我使用

awk  '{for(i=1;i<=NF;i++){if($i~/113/){print $1, $2, $3, $4}}}' < bigfile > x_113_list
Run Code Online (Sandbox Code Playgroud)

我得到了理想的结果

但是,如果我试试

Y=113
awk -v y="$Y" '{for(i=1;i<=NF;i++){if($i~/y/){print $1, $2, $3, $4}}}' < bigfile > x_"$Y"_list 
Run Code Online (Sandbox Code Playgroud)

我一无所获.(即使我在命令行上尝试也是这种情况)我做错了什么?

bash shell awk

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