我试图在intellij的nexus 5上安装一个应用程序,这是我第一次收到错误消息
"DeviceMonitor: Adb rejected connection to client '5081': closed"
Run Code Online (Sandbox Code Playgroud)
我尝试重新启动我的adb重启计算机,禁用,启用android调试同步gradle.奇怪的是,当我尝试在虚拟设备上运行它时,它可以工作.有人有想法吗?这是完整的错误代码:
DeviceMonitor:Adb拒绝与客户'5081'的连接:已关闭DeviceMonitor:Adb拒绝与客户'5064'的连接:已关闭DeviceMonitor:Adb拒绝与客户'4962'的连接:已关闭DeviceMonitor:Adb拒绝与客户'5081'的连接:已关闭DeviceMonitor: Adb拒绝与客户'5064'的连接:已关闭DeviceMonitor:Adb拒绝与客户'5064'的连接:已关闭DeviceMonitor:Adb拒绝与客户'3483'的连接:已关闭DeviceMonitor:Adb拒绝与客户'3483'的连接:已关闭
logcat没有显示任何内容,我尝试在终端"adb logcat"中运行它,它显示正常.
我想从屏幕中心开始一个新的活动作为一个消耗的圈子,所以活动将显示为这样的圆圈.

这是我当前的代码anim.xml
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<scale
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="200"
android:fromXScale="0"
android:fromYScale="0"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1"
android:toYScale="1" >
</scale>
Run Code Online (Sandbox Code Playgroud)
animback.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.0"
android:toYScale="1.0" >
</scale>
</set>
Run Code Online (Sandbox Code Playgroud)
调用动画
overridePendingTransition(R.anim.anim,R.anim.animback);
Run Code Online (Sandbox Code Playgroud)
当前代码只是放大了新活动,但我希望活动从中心显示为一个圆圈.
我想从其他应用程序中读取日志并过滤它们,以便在记录某个关键字时,我的应用程序将执行某项任务.
我找到了几种读取日志的方法,但从我的测试中我只能得到我的应用程序日志.
这是我最初尝试使用的方法
try {
Process process = Runtime.getRuntime().exec("logcat -d");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
StringBuilder log=new StringBuilder();
String line = "";
while ((line = bufferedReader.readLine()) != null) {
log.append(line);
}
TextView tv = (TextView)findViewById(R.id.textView1);
tv.setText(log.toString());
}
catch (IOException e) {}
Run Code Online (Sandbox Code Playgroud)
但它似乎只读取我的应用程序的日志.
我有一个曾经工作过的代码,但由于某种原因它突然停止工作,我试图在希伯来语中使用语音识别,但似乎几天前它才开始用英语进行语音识别。
这是我的代码
sr = SpeechRecognizer.createSpeechRecognizer(getApplicationContext());
test_voice_recognitiona listener = new test_voice_recognitiona();
sr.setRecognitionListener(listener);
Intent fl = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
fl.putExtra("android.speech.extra.LANGUAGE", "he");
fl.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "he");
fl.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
this.getPackageName());
sr.startListening(fl);
Run Code Online (Sandbox Code Playgroud)
test_voice_recognitiona 是我的 RecognitionListener 类名。
代码运行良好,但出于某种原因,它一直在用英语收听。
我究竟做错了什么?
顺便说一下,我在谷歌对话框中尝试了更简单的代码,它正在工作。
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "he");
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Talk to Me " + user_name);
startActivityForResult(intent,REQUEST_CODE);
Run Code Online (Sandbox Code Playgroud)
也许是谷歌现在更新错误
android speech-recognition voice-recognition recognizer-intent
我有一个大约300万行的文本文件,我需要用""替换每行的前两个字符.我目前的代码是
String[] lines = content.split("\n");
content = "";
for(int i = 0;i<lines.length;i++){
System.out.println(i);
lines[i].substring(2);
content = content + lines[i];
}
Run Code Online (Sandbox Code Playgroud)
完成需要3-4天左右.有更快的方法吗?
我的整个代码:
try {
String content = readFile("text.txt", StandardCharsets.ISO_8859_1);
content = content.replaceAll("\\d","");
content = content.replaceAll("\\.","");
String[] lines = content.split("\n");
content = "";
for(int i = 0;i<lines.length;i++){
System.out.println(i);
lines[i].substring(2);
content = content + lines[i];
}
PrintWriter out = new PrintWriter("texty text.txt");
out.println(content);
} catch (IOException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud) 我在我的电脑上下载并构建了新的android棒棒糖源代码,并尝试将代码导入IDE,我尝试了intellij和android studio使用这里的帖子
我尝试执行development/tools/idegen/idegen.sh文件,但似乎不断收到java文件错误
Exception in thread "main" java.io.FileNotFoundException: ./out/target/product/hammerhead/obj/GYP/shared_intermediates/res.java (Is a directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileReader.<init>(FileReader.java:72)
at Configuration.parsePackageName(Configuration.java:204)
at Configuration.rootOf(Configuration.java:180)
at Configuration.traverse(Configuration.java:140)
at Configuration.traverse(Configuration.java:167)
at Configuration.traverse(Configuration.java:167)
at Configuration.traverse(Configuration.java:167)
at Configuration.traverse(Configuration.java:167)
at Configuration.traverse(Configuration.java:167)
at Configuration.traverse(Configuration.java:167)
at Configuration.traverse(Configuration.java:167)
at Configuration.<init>(Configuration.java:72)
at Main.main(Main.java:37)
Run Code Online (Sandbox Code Playgroud)
这个方法在KitKat源代码中对我有用,但在这个版本中我一直收到这个错误.
我真的不知道该怎么做了.
我真的需要使用intellij或android studio作为AOSP代码.
请帮忙.
java android intellij-idea android-source android-5.0-lollipop
嗨,我想在谷歌导航栏上拖动时更改我的应用程序徽标.这是我的申请清单:
<application
android:theme="@android:style/Theme.Holo.Light"
android:icon="@drawable/ic_launcher"
android:logo="@drawable/ic_launcher"
android:screenOrientation="portrait"
android:debuggable="false"
android:label="@string/app_name" >
Run Code Online (Sandbox Code Playgroud)
