我遇到了这个问题java.lang.IllegalArgumentException: method ID not in [0, 0xffff]: 65536,我决定从dex文件中排除一些方法.我的gradle.build:
compile ('com.google.android.gms:play-services:+') {
exclude group: "com.google.android.gms.analytics"
exclude group: "com.google.android.gms.games"
exclude group: "com.google.android.gms.plus"
exclude group: "com.google.android.gms.drive"
exclude group: "com.google.android.gms.ads"
}
Run Code Online (Sandbox Code Playgroud)
我认为这段代码是错误的,因为有错误method ID not in [0, 0xffff]....如何排除Google Play服务中不必要的部分?我只使用地图和GCM.
更新.
谢谢reVerse.这是非常有用的代码.有一个用于获取方法计数的脚本(也可以看到现有包的名称)https://gist.github.com/JakeWharton/6002797(source ./dex.sh; dex-method-count-by-package test.apk)
在使用reVerse的答案代码片段之前
Count of methods / Package
...
22484 com.google.android.gms
2 com.google.android.gms.actions
578 com.google.android.gms.ads
152 com.google.android.gms.ads.doubleclick
25 com.google.android.gms.ads.identifier
86 com.google.android.gms.ads.internal
86 com.google.android.gms.ads.internal.rawhtmlad
86 com.google.android.gms.ads.internal.rawhtmlad.client
88 com.google.android.gms.ads.mediation
4 com.google.android.gms.ads.mediation.admob
73 com.google.android.gms.ads.mediation.customevent
26 com.google.android.gms.ads.purchase
118 com.google.android.gms.ads.search …Run Code Online (Sandbox Code Playgroud) 我有代码:
class A {
override def toString = "object class A"
}
class B extends A {
override def toString = "object class B"
}
class Cell[+T](init: T) {
private[this] var current: T = init
def get: T = current
def set(x: T) { current = x }
}
val cB = new Cell[B](new B)
println(cB.get)
val cA: Cell[A] = cB
println(cA.get)
Run Code Online (Sandbox Code Playgroud)
但我有错误: def set(x: T) { current = x }
错误:协变类型T出现在类型T中的逆变位置x def set(x:T){current = x}
请解释
我正在使用三个不同的查询来获取带有以下URI的照片,电子邮件和电话号码:
private final Uri mEmailUri = ContactsContract.CommonDataKinds.Email.CONTENT_URI;
private final Uri mPhotoUri = ContactsContract.Data.CONTENT_URI;
private final Uri mPhoneUri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
Run Code Online (Sandbox Code Playgroud)
获取记录需要很长时间.有没有更快的方法来完成它?
我不明白.为什么Scala支持覆盖方法作为字段:
abstract class A {
def i: Int;
}
class B extends A {
val i = 123;
}
val obj:A = new B();
println(obj.i)
Run Code Online (Sandbox Code Playgroud)
方法i是字段i.为什么?
我有后台的监听器:
getFragmentManager().
addOnBackStackChangedListener(new OnBackStackChangedListener() {
@Override
public void onBackStackChanged() {
Log.d("MainActivity", "Change fragment");
}
});
Run Code Online (Sandbox Code Playgroud)
还有两个按钮.事件onClick第一个按钮:
getFragmentManager().
beginTransaction().
add(R.id.root, fragm).
commit();
Run Code Online (Sandbox Code Playgroud)
事件onClick第二个按钮:
getFragmentManager().
beginTransaction().
remove(fragm).commit();
Run Code Online (Sandbox Code Playgroud)
但听众不行.功能onBackStackChanged不会调用.