我需要在Android Studio(beta)0.84中查找并提取项目中的所有硬编码字符串.我需要像Find Bugs这样的静态分析工具一次性为我做这件事,并允许我逐步完成每条消息并将字符串提取到资源文件.如果整个过程是自动化的,那就更好了.
在Android Studio(测试版)0.84中,文件/设置/ FindBugs-IDEA在报告选项卡下显示I18N作为选项.但我无法弄清楚如何让它发挥作用.
谢谢你的任何建议.
我有一个核心Android库,我使用@Singleton作用域来定义CoreComponent广告,以注入CoreModule提供的类的实例.
@Singleton
@Component(modules = {CoreModule.class})
public interface CoreComponent {
void inject(SomeClass target);
}
@Module
public class CoreModule {
@Singleton
@Provides
CoreRepository provideCoreRepository() {
return new CoreRepositoryImpl();
}
}
Run Code Online (Sandbox Code Playgroud)
我想从另一个依赖于核心库的Android库访问相同的@Singleton实例,并且正在使用另一个组件.
@Singleton
@FooScope
@Component(modules = {CoreModule.class, FooModule.class})
public interface FooComponent {
void inject(SomeActivity target);
}
public class FooActivity extends AppCompatActivity {
@Inject
public CoreRepository repo;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
injectDependencies();
super.onCreate(savedInstanceState);
}
[...]
}
Run Code Online (Sandbox Code Playgroud)
上面的代码构建,但@Singleton范围是Component的"本地".换句话说,有两个单例实例,一个用于CoreComponent,另一个用于FooComponent.
Android Application
??? Foo Library
| ??? Core Library
??? Bar Library
| ??? …
Run Code Online (Sandbox Code Playgroud) 我无法通过bitbucket.org上的私人git repo获取Jenkins git插件进行身份验证.我使用ssh-keygen生成了私钥/公钥对,并在ssh密钥帐户页面下的bitbucket帐户中设置了公钥.
在作业配置页面中,我将源代码管理部分设置如下:
Repository URL: git@bitbucket.org:mproject.git (the SSH url for clone)
Credentials: The private key id_rsa generated by ssh-keygen (no passphrase) and user git.
Run Code Online (Sandbox Code Playgroud)
它立即给出以下错误:
Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h git@bitbucket.org:myproject.git HEAD" returned status code 128:
stdout:
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
当我从shell中的工作区目录中的命令行执行相同的git命令时,它可以正常工作.我在构建环境/属性文件路径中指定了〜/ .bashrc,所以当我在jenkins作业中运行时,我感到困惑.
我的jenkins机器上只有两个用户(jenkins和root),我正在以用户jenkins的身份运行git命令.用户jenkins的主目录是/ home/jenkins.我的jenkins工作以匿名用户身份运行.这可能是问题吗?
我有以下.ssh文件:
-rw-r--r--. 1 jenkins jenkins 89 Apr …
Run Code Online (Sandbox Code Playgroud) 在我的多项目中,我在根项目上运行测试任务,并期望它将在子项目上运行测试任务并生成单个测试报告。我观察到它从来没有在子项目上运行测试任务。我的期望是否不正确”我需要在我的 gradle 脚本中做任何特殊的配置吗?
请注意,我的根项目中没有测试。
我有一个活动,它有一个带有垂直LinearLayout的ScrollView,它有两个片段,它们是PreferenceFragment实例,如下面的布局文件所示:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="wrap_content"
android:layout_width="match_parent"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context="com.foo.app.SettingsActivity">
<fragment
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:name="com.foo.app.SettingsFragment"
android:id="@+id/fragment_settings"/>
<fragment
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:name="com.foo.app.NotificationSettingsFragment"
android:id="@+id/fragment_notification_settings"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
问题是这两个片段只显示了他们的PreferenceCategory标题,而实际的片段UI是零高度且不可见.奇怪的是,可以单独滚动每个片段并查看丢失的片段UI.就好像每个Fragment都在ScrollView中.
我期望的是两个片段的大小可以包装它们的内容,并且有一个垂直滑块可以滚动包含两个片段的LinearLayout.
如果它是相关的,这两个片段扩展android.preference.PreferenceFragment并且不在布局文件中定义它们的布局.相反,他们加载他们的Preference UI如下:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.pref_notification);
}
Run Code Online (Sandbox Code Playgroud)
TIA的帮助.
我正在使用以下 Dockerfile 创建一个 docker 映像:
FROM java:openjdk-8-jdk-alpine
USER root
RUN apk update && apk add docker
COPY . /liveboard-tests
WORKDIR /liveboard-tests
ENTRYPOINT ["./gradlew", ":integration-tests:test", "--tests", "*Foo*"]
Run Code Online (Sandbox Code Playgroud)
由于某种原因,docker容器不包含javac或tools.jar,我无法编译java代码。我尝试过各种其他基础图像,它们都有同样的问题。
任何人都可以建议一个防弹的最小 Docker 文件,它将为我提供一个能够使用 javac 并具有 tools.jar 的容器。TIA。
我最近用一个最小的存根MainActivity创建了一个新的应用程序.当我使用Android Studio和gradle项目运行应用程序时,应用程序失败并显示以下消息:
Uploading file
local path: C:\Users\fnajmi\myapp-android\app\build\apk\app-debug-unaligned.apk
remote path: /data/local/tmp/com.myapp.app
Installing com.myapp.app
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.myapp.app"
pkg: /data/local/tmp/com.myapp.app
Success
Launching application: com.myapp/com.myapp.app.HomeActivity.
DEVICE SHELL COMMAND: am start -n "com.myapp.app/com.myapp.app.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.myapp.app/com.myapp.app.MainActivity }
Error type 3
Error: Activity class {com.myapp.app/commyapp.app.MainActivity} does not exist.
Run Code Online (Sandbox Code Playgroud)
我检查了我的整个项目文件夹树,但我无法在任何地方找到"myapp"这个词.这是我过去使用的包名,但后来改了.那么我想知道这是从哪里来的?
我正在使用vagrant和chef将Eclipse和Eclipse插件配置到Ubuntu虚拟机.需要使用equinox.p2安装所有插件.以下是安装Buildship插件的示例:
eclipse -application org.eclipse.equinox.p2.director -noSplash -repository http://download.eclipse.org/buildship/updates/e46/releases/1.0 -installIUs org.eclipse.buildship.feature.group
在许多情况下,插件只提供市场安装按钮,没有更新站点URL,也没有关于插件ID的详细信息.
如何获取此类插件的更新站点URL和插件ID?
在 Android 4.3 嵌入式(自定义)设备上,我试图通过在服务子类 onStartCommand 方法中设置断点来调试我的应用程序。当我在断点处暂停时,由于 ANR 没有意识到我正在调试,dalvik 会杀死我的应用程序。
logcat 显示:
W/ANRWatchdog: An ANR was detected but ignored because the debugger is connected (you can prevent this with setIgnoreDebugger(true))
I/dalvikvm: threadid=3: reacting to signal 3
D/dalvikvm: threadid=1: still suspended after undo (sc=1 dc=1)
I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'
Run Code Online (Sandbox Code Playgroud)
请注意,我的应用中有一个ANRWatchDog,它可以正确识别调试会话并忽略 ANR。
有没有办法对 Dalvik 做同样的事情?我假设可以在不因 ANR 而崩溃的情况下调试服务。