我读了很多帖子来解决这个问题.没有人为我工作.
错误:
Target device: lenovo-lenovo_a6000-89a70dc9
Installing APK: C:\Users\Nikhil\AndroidStudioProjects\ProfitKey\app\build\outputs\apk\app-debug.apk
Uploading file to: /data/local/tmp/helix.profitkey.hotelapp
java.io.IOException: An existing connection was forcibly closed by the remote host
Run Code Online (Sandbox Code Playgroud)
我在下面试过
它正在工作的另一个设备.但之前这两款设备对我来说都很好.
Target device: motorola-xt1022-ZX1B33PRVP
Installing APK: C:\Users\Nikhil\AndroidStudioProjects\ProfitKey\app\build\outputs\apk\app-debug.apk
Uploading file to: /data/local/tmp/helix.profitkey.hotelapp
Installing helix.profitkey.hotelapp
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/helix.profitkey.hotelapp"
pkg: /data/local/tmp/helix.profitkey.hotelapp
Success
Run Code Online (Sandbox Code Playgroud)
编辑:
我试过两台联想A6000.一个正在工作,另一个正在工作.然后,Moto正在工作,而三星Galaxy也没有工作.每当我杀死并开始adb时.任务管理器首先创建两个adb,几秒钟之后就隐藏了一个adb.这是一个问题吗?但仍有一些设备工作正常.
adb在被命令杀死后自动启动,或者如果android studio打开则从任务管理器启动.
我有一个StringBuffer在for循环外部和内部for循环初始化我连接一些字符串.
我收到了警告
'StringBuffer stringBuffer'可以声明为'StringBuilder'
和
字符串连接作为'stringbuilder.append()'调用的参数
然后我将StringBuffer更改为StringBuilder,因为它比StringBuffer快.现在我收到了警告
字符串连接作为'stringbuilder.append()'调用的参数
示例代码:
public static String stringConcat(String[] words) {
StringBuffer stringBuffer = new StringBuffer();
for (String word : words) {
stringBuffer.append(word).append(" ");
}
return stringBuffer.toString();
}
Run Code Online (Sandbox Code Playgroud)
为什么我收到这些警告.
编辑实际代码:
stringBuffer.append(word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase()).append(" ");
Run Code Online (Sandbox Code Playgroud) java stringbuilder android string-concatenation stringbuffer
if(a && b || c || d || e)
Run Code Online (Sandbox Code Playgroud)
是否检查(a && b),如果a和b必须始终为真,那么只允许在里面?要么
((a && b) || a && c || a && d || a && e)),任何条件都是真的会允许内部吗?
以下代码与轮廓输入框完美配合。
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/notes"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/text_notes"
app:boxBackgroundColor="@color/colorWhite">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_notes"
android:fontFamily="sans-serif-black"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
我在整个应用程序中设置了自定义字体。按以下代码设置后,它崩溃了。以下样式用于应用程序主题。
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textViewStyle">@style/SansSerifTextViewStyle</item>// Custom font style
<item name="buttonStyle">@style/SanSerifButtonStyle</item> // Custom font style
</style>
Run Code Online (Sandbox Code Playgroud)
当我删除以下行时,应用程序不会崩溃。但是勾勒出来的框 UI 不会出现。尝试通过 Java 代码设置,无效。
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
Run Code Online (Sandbox Code Playgroud)