在调试时,Eclipse中的Debug视图显示调用堆栈.哪个好.但是我希望能够过滤掉我绝对不关心的所有调用,例如Spring和JUnit runner.
这是我现在调用堆栈的一个例子.我想把这些条目保持为粗体,同时隐藏所有其他条目.有可能以任何方式吗?(插件,下一个Eclipse发行版,配置......)
com.myproject.mymodule.MyFinderObject.fetchDestinationSettings
com.myproject.mymodule.MyFinderObject.compareCurrentSettings
com.myproject.mymodule.MyFinderObject.compareSettings
sun.reflect.NativeMethodAccessorImpl.invoke0
sun.reflect.NativeMethodAccessorImpl.invoke
sun.reflect.DelegatingMethodAccessorImpl.invoke
java.lang.reflect.Method.invoke
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
com.myproject.caching.CachingInterceptor.invoke
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
org.springframework.aop.framework.JdkDynamicAopProxy.invoke
$Proxy43.doSthWith
com.myproject.mymodule.MyFinderObjectTest.testSettingComparisonForCurrentSettings
sun.reflect.NativeMethodAccessorImpl.invoke0
sun.reflect.NativeMethodAccessorImpl.invoke
sun.reflect.DelegatingMethodAccessorImpl.invoke
java.lang.reflect.Method.invoke
com.myproject.mymodule.MyFinderObjectTest
com.myproject.mymodule.MyFinderObjectTest
com.myproject.mymodule.MyFinderObjectTest
junit.framework.TestResult$1.protect
junit.framework.TestResult.runProtected
junit.framework.TestResult.run
com.myproject.mymodule.MyFinderObjectTest
junit.framework.TestSuite.runTest
junit.framework.TestSuite.run
org.junit.internal.runners.JUnit38ClassRunner.run
org.eclipse.jdt.internal.junit4.runner.JUnit4TestMethodReference
org.eclipse.jdt.internal.junit.runner.TestExecution.run
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.mainRun Code Online (Sandbox Code Playgroud) Android的<include />元素允许您包含其他XML布局.对于跨多个活动的公共标题很有用.
但是,如果你想要的东西,包括布局若干倍,在同样的看法?例如,我有一个精心设计的布局,我希望在我的视图中显示三次.每个实例都需要不同的值.由于include基本上是XML并将其粘贴到此处,因此我需要更强大的功能.
有没有一些机制来做到这一点?
(我是否正确解释了自己?)
我正在从Android Studio运行我的Android应用程序,并且Instant Run启动,这很棒.我想从命令行运行完全相同的东西.
在Android Studio的事件日志中,我看到了
22:00:28 Executing tasks: [:app:incrementalDevDebugSupportDex]
22:00:48 Gradle build finished in 20s 286ms
22:00:51 Instant Run applied code changes and restarted the current Activity.
Run Code Online (Sandbox Code Playgroud)
所以,我希望我能够从命令行运行该任务:./gradlew :app:incrementalDevDebugSupportDex.但是,没有找到:
FAILURE: Build failed with an exception.
* What went wrong:
Task 'incrementalDevDebugSupportDex' not found in project ':app'.
Run Code Online (Sandbox Code Playgroud)
有没有办法从命令行运行Instant Run?
哪里可以找到android默认样式定义的源代码,比如?android:attr/progressBarStyle?
我知道Android repo是在https://github.com/android中复制但是......我找不到styles.xml,strings.xml等等!
我已仔细按照官方指南中的说明在Eclipse ADT 3.8中启用注释.
也就是说,正确配置了注释处理和工厂路径:


我的Android应用程序编译成功.当然,它也会运行,但由于预期由Butter Knife停留的观点,我会得到明显的NPE null.
如果我将配置更改为生成.apt_generated_foo_bar,那么Eclipse将创建该文件夹.但是空的.
关于如何说服Eclipse创建适当的类的任何想法.apt_generated?
我有一个Android项目,分为三个不同的应用程序app-1,app-2并且app-3,它们应用了一些自定义.目前存在大量代码重复,使维护成为一场噩梦:在其中一个分支中进行更改,然后合并其他两个分支.
因此,我们创建了一个名为的库项目,app-core该项目将大部分重复的代码排除在外.到现在为止还挺好.
当我将其启动到已经加载应用程序的模拟器中时(在重构之前),我得到以下异常:
Re-installation failed due to different application signatures
一个不同的签名?但我只是在.classpath链接到app-coreJava项目中添加了一行!
主要问题是:现有用户是否也会受到这种困扰?
而旁边的问题:为什么它是一个不同的签名?
假设我在两个级别都定义了一个常量:在构建类型中,我将其设置为"mybuild",并将其设置为"myflavor".
比如在这里:
buildTypes {
debug {
resValue "string", "analytics_key", "XXX_SANDBOX_KEY_XXX"
}
}
productFlavors {
appA {
resValue "string", "analytics_key", "XXX_KEY_FOR_A_XXX"
}
appB {
resValue "string", "analytics_key", "XXX_KEY_FOR_A_XXX"
}
}
Run Code Online (Sandbox Code Playgroud)
我想将不同应用程序(即风味)的事件发送到我的分析平台中的不同帐户.但是,如果我正在调试,我想将它们全部发送到我的沙盒帐户.
最初的问题是:哪个优先?从我的测试中,我已经可以回答:构建类型中的那个.
然而,更有趣的是:这有保证吗?
(或者,有更好的方法吗?)
我想创建一个加载了Google API的ARM API 21模拟器.
以下是我创建AVD的方法:
ANDROID_ABI=google_apis/armeabi-v7a
EMULATOR_VERSION=21
avd --force -n nexus4-emulator -t "Google Inc.:Google APIs:"$EMULATOR_VERSION --abi $ANDROID_ABI --device "Nexus 4" -c 128M
Run Code Online (Sandbox Code Playgroud)
现在我启动模拟器:
emulator -avd nexus4-emulator &
Run Code Online (Sandbox Code Playgroud)
然而,这就是我得到的:一个尺寸很小的屏幕(就有效像素而言):
如何更改此配置以便我拥有适当大小的屏幕?
顺便说一句,我正在使用它来构建APK并在Travis中的机器上运行测试,但它在我的机器(Mac OS X)中可以重现.
我想用Java编写一个方法来验证某些条件是否存在某些数据,并确认数据有效或产生适当的错误消息.
问题是我们不能从一个方法返回多个东西,所以我想知道最佳解决方案是什么(在可读性和可维护性方面).
第一解决方案 很容易,但我们无法知道究竟是什么使检查失败:
boolean verifyLimits1(Set<Integer> values, int maxValue) {
for (Integer value : values) {
if (value > maxValue) {
return false; // Out of limits
}
}
return true; // All values are OK
}
Run Code Online (Sandbox Code Playgroud)
二解决方案.我们有消息,但我们正在以一种我们不应该使用的方式使用异常(此外,它应该是特定于域的已检查异常,过多的开销IMO):
void verifyLimits2(Set<Integer> values, int maxValue) {
for (Integer value : values) {
if (value > maxValue) {
throw new IllegalArgumentException("The value " + value + " exceeds the maximum value");
}
}
}
Run Code Online (Sandbox Code Playgroud)
第三种方案.我们有一个详细的消息,但合同不干净:我们让客户端检查String是否为空(他需要读取javadoc).
String verifyLimits3(Set<Integer> values, int maxValue) { …Run Code Online (Sandbox Code Playgroud) android ×8
eclipse ×2
java ×2
annotations ×1
butterknife ×1
callstack ×1
classpath ×1
debugging ×1
gradle ×1
include ×1
instant-run ×1
layout ×1
readability ×1
reinstall ×1
travis-ci ×1