我的android studio模拟器有问题。每当我点击运行时,都会弹出一条消息。 无法安装该应用程序:SKIPPED_INSTALL无法终止com.smstechnology.diceroller重试。 这是mainActivity.kt
package com.smstechnology.diceroller
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
/**
* This activity allows the user to roll a dice and view the result
* on the screen.
*/
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val rollButton: Button = findViewById(R.id.bottom)
rollButton.setOnClickListener {
rollDice()
}
}
/**
* Roll the dice and update the screen with the result.
*/
private fun rollDice() {
// Create new Dice object with 6 sides and roll it
val dice = Dice(6)
val diceRoll = dice.roll()
// Update the screen with the dice roll
val resultTextView: TextView = findViewById(R.id.textView)
resultTextView.text = diceRoll.toString()
}
}
class Dice(private val numSides: Int) {
fun roll(): Int {
return (1..numSides).random()
}
}
答案 0 :(得分:0)
这些安装失败似乎具有各种解决方案-希望有人知道特定消息的含义!
我个人会尝试使用红色停止按钮从Android Studio中终止该应用程序。如果这不起作用,请尝试在模拟器上进入应用程序的设置(您可以长按任务切换器上的应用程序图标)并强制停止
有些人在禁用Instant Run方面取得了一些成功,但是我再也看不到这种选择了
对我来说,通常是因为虚拟设备没有足够的存储空间-如果我将其增加1GB左右,一切都会正常进行。这不是一个很有帮助的信息!