5번째 강의 첫번째 부분에서 오류가 생겼습니다.
362
작성한 질문수 14
아래는 코드들입니다.
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ListView
android:id="@+id/mainlistview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
MainActivity.kt
package com.example.listview
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.ListView
import android.widget.Toast
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
//val list_item = mutableListOf<String>()
//list_item.add("A")
//list_item.add("B")
//list_item.add("C")
val list_item2 = mutableListOf<listviewmodel>()
list_item2.add(listviewmodel("a","b"))
list_item2.add(listviewmodel("c","d"))
//어뎁터와 메인을 연결하는 과정
val listview = findViewById<ListView>(R.id.mainlistview)
val listviewadapter = ListViewAdapter(list_item2)
listview.adapter = listviewadapter
listview.setOnItemClickListener{parent, view, position, id ->
Toast.makeText(this, list_item2[position].text1,Toast.LENGTH_LONG).show()
}
}
}
ListViewAdapter.kt
package com.example.listview
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.TextView
class ListViewAdapter(val List : MutableList<listviewmodel>) : BaseAdapter() {
override fun getCount(): Int {
return List.size
}
override fun getItem(p0: Int): Any {
return List[p0]
}
override fun getItemId(p0: Int): Long {
return p0.toLong()
}
override fun getView(position: Int, converView: View?, parent: ViewGroup?): View {
var converView = converView
if (converView == null) {
converView = LayoutInflater.from(parent?.context).inflate(R.layout.listview_item, parent, false)
}
val title = converView!!.findViewById<TextView>(R.id.listviewitemview1)
val title2 = converView!!.findViewById<TextView>(R.id.listviewitemview2)
title.text = List[position].text1
title2.text = List[position].text2
return converView!!
}
}
llistview_item.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ListView
android:id="@+id/mainlistview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
이렇게 코드를 적고 디버깅을 할 때
07/18 14:45:35: Launching 'app' on leejanghan.
Installation did not succeed.
The application could not be installed.
List of apks:
[0] 'C:\Users\User\AndroidStudioProjects\listview\app\build\intermediates\apk\debug\app-debug.apk'
Installation failed due to: ''cmd package install-create -r -t --user current --full --dont-kill --skip-verification -S 5146924' returns error 'Unknown failure: Exception occurred while executing 'install-create':
android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space
at android.util.ExceptionUtils.wrap(ExceptionUtils.java:34)
at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:595)
at com.android.server.pm.PackageManagerShellCommand.doCreateSession(PackageManagerShellCommand.java:3416)
at com.android.server.pm.PackageManagerShellCommand.runInstallCreate(PackageManagerShellCommand.java:1561)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:232)
at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
at android.os.ShellCommand.exec(ShellCommand.java:38)
at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onShellCommand(PackageManagerService.java:5952)
at android.os.Binder.shellCommand(Binder.java:1049)
at android.os.Binder.onTransact(Binder.java:877)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4313)
at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onTransact(PackageManagerService.java:5936)
at android.os.Binder.execTransactInternal(Binder.java:1285)
at android.os.Binder.execTransact(Binder.java:1244)
Caused by: java.io.IOException: Requested internal only, but not enough space
at com.android.internal.content.InstallLocationUtils.resolveInstallVolume(InstallLocationUtils.java:241)
at com.android.internal.content.InstallLocationUtils.resolveInstallVolume(InstallLocationUtils.java:152)
at com.android.internal.content.InstallLocationUtils.resolveInstallVolume(InstallLocationUtils.java:167)
at com.android.server.pm.PackageInstallerService.createSessionInternal(PackageInstallerService.java:803)
at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:592)
... 12 more''
Retry
Failed to launch an application on all devices
와 같은 오류가 뜹니다
코드의 내용은 잘 적은 것 같은데, 오류가 발생해 그 이유가 무엇인지 궁금합니다.
감사합니다!!
답변 1
주사위앱 소개 및 레이아웃 설정 문제
0
81
2
안드로이드 에뮬레이터가 실행이 안 되요...ㅠ
0
141
2
30 강 소스 좀 올려 주십시요
0
97
2
onBackPressed 함수가 동영상 하고 다르게 동작합니다.
0
108
2
ListView 초기 실행 안됩니다.
0
110
2
코딩을 완료하고난후 앱 실행시 자동 종료
0
87
2
datavinding에서 오류가 납니다.
0
64
1
안드로이드 스튜디오 버전 차이로 초기 empyt activity 선택하면 안됩니다.
0
138
2
context의 구별에 대하여
0
86
2
"프롤로그에서 ..." 오류 관련해 직전 질문에 대한 추가 질문입니다.
0
80
2
"프롤로그에서 콘텐츠가 허용되지 않습니다." 오류
0
187
3
해결완료
1
205
2
databinding 설정후 run하면 에러(해결)
0
234
2
databinding 설정 이후 실행시 에러
0
297
4
안드로이드 입문하는 사람입니다.
0
78
1
Firebase uid
0
90
3
activity_main 화면 다름
0
129
2
강의화면과 다른데 맞게진행되는것인가요...????
0
117
2
파이어베이스 질문
0
84
2
ActivityMainBinding에 오류가 납니다
0
146
2
선생님 onBackPressed 작동이 안되는거 같습니다
0
128
2
>app>res>layout 이 존재하지 않습니다.
0
124
2
안드로이드 스튜디오 미어캣 버전 사용 한글 깨짐
0
784
2
안드로이드 스튜디오 오류 발생 시 대처 방법은 요?
0
310
2





