独学プログラミング演習
テキスト | 日付 | 進捗状況 |
---|---|---|
Spring解体新書(バッチ編) | 2022/08/08 | finished ->コード |
Kotlinプログラミング | 2019/11/13 | finished ->コード |
はじめてのAndroidプログラミング | 2019/10/12 | finished ->コード |
端末 | 環境/FW | 最終更新 |
---|---|---|
InsiderDev | IntelliJ IDEA 2024.3 | 2024/11/16 |
- Kotlin 2.0.20 | 2024/09/27 | |
Amazon Coretto 22.0.2 | 2024/11/16 | |
Android Studio Meerkat 2024.3.1 Canary 3 | 2024/11/23 | |
- Kotlin 2.0.21 | 2024/10/19 | |
- Android SDK Command-line Tools v.16 | 2024/09/04 | |
- Android Emulator v.35.4.2 | 2024/11/24 |
Build #IC-243.21565.193, built on November 13, 2024
Runtime version: 21.0.5+8-b631.16 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 2048M
Cores: 8
Registry:
ide.experimental.ui=true
i18n.locale=
Non-Bundled Plugins:
org.jetbrains.plugins.gitlab (243.21565.204)
Kotlin: 243.21565.193-IJ
tasks.named("compileKotlin", org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask::class.java) {
compilerOptions {
freeCompilerArgs.add("-Xjsr305=strict")
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
}
}
plugins {
id("org.springframework.boot") version "3.2.0"
id("io.spring.dependency-management") version "1.1.3"
kotlin("jvm") version "1.9.23"
kotlin("plugin.spring") version "1.8.10"
}
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Kotlin2JvmCompilerArguments">
<option name="jvmTarget" value="21" />
</component>
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.22-release-704" />
</component>
</project>
"kotlin": "cd $dir && kotlinc-jvm.bat $fileName -include-runtime -d $fileNameWithoutExt.jar && java -jar $fileNameWithoutExt.jar"
companion object {
private val log: Logger = LoggerFactory.getLogger(this::class.java)
}
Build #AI-243.21565.193.2431.12691553, built on November 21, 2024
Runtime version: 21.0.5+-12651406-b631.16 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 2048M
Cores: 8
Registry:
ide.experimental.ui=true
i18n.locale=
Non-Bundled Plugins:
Dart (243.22562.3)
io.flutter (82.2.4)
path=F:\Program\.android\avd\Nexus_5X_API_28.avd
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testImplementation 'org.testng:testng:7.10.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.2'
dependencies {
...
implementation 'androidx.test.ext:junit-ktx:1.1.5'
testImplementation 'junit:junit:4.13.2'
...
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
内部エラーが発生しました。Please refer to https://code.google.com/p/android/issues
com.intellij.ide.plugins.StartupAbortedException: UI initialization failed
at com.intellij.idea.StartupUtil.lambda$start$15(StartupUtil.java:268)
at java.base/java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:986)
at java.base/java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:970)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:610)
at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:791)
at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.util.concurrent.CompletionException: java.lang.VerifyError: Expecting a stack map frame
Exception Details:
Location:
com/intellij/openapi/util/text/StringUtil.pluralize(Ljava/lang/String;I)Ljava/lang/String; @7: nop
Reason:
Expected stackmap frame at this location.
Bytecode:
0000000: 2ab0 0000 a7ff fe00 bf00 00a7 fffe
Stackmap Table:
same_frame(@2)
same_frame(@9)
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:787)
... 14 more
Caused by: java.lang.VerifyError: Expecting a stack map frame
Exception Details:
Location:
com/intellij/openapi/util/text/StringUtil.pluralize(Ljava/lang/String;I)Ljava/lang/String; @7: nop
Reason:
Expected stackmap frame at this location.
Bytecode:
0000000: 2ab0 0000 a7ff fe00 bf00 00a7 fffe
Stackmap Table:
same_frame(@2)
same_frame(@9)
at com.intellij.openapi.util.SystemInfo.isOsVersionAtLeast(SystemInfo.java:51)
at com.intellij.openapi.util.SystemInfo.<clinit>(SystemInfo.java:54)
at com.intellij.ui.JreHiDpiUtil.isJreHiDPIEnabled(JreHiDpiUtil.java:58)
at com.intellij.ui.scale.JBUIScale.getOrComputeUserScaleFactor(JBUIScale.java:190)
at com.intellij.ui.scale.JBUIScale.scale(JBUIScale.java:314)
at com.intellij.ui.scale.UserScaleContext.<init>(UserScaleContext.java:26)
at com.intellij.util.ui.JBUI$BaseScaleContext.<init>(JBUI.java:1408)
at com.intellij.ui.scale.ScaleContext.<init>(ScaleContext.java:32)
at com.intellij.ui.scale.ScaleContext.create(ScaleContext.java:108)
at com.intellij.ui.scale.ScaleContextSupport.<init>(ScaleContextSupport.java:11)
at com.intellij.openapi.util.IconLoader$CachedImageIcon.<init>(IconLoader.java:702)
at com.intellij.ui.CoreIconManager$IconWithToolTipImpl.<init>(CoreIconManager.java:91)
at com.intellij.ui.CoreIconManager.loadRasterizedIcon(CoreIconManager.java:61)
at com.intellij.icons.AllIcons.load(AllIcons.java:17)
at com.intellij.icons.AllIcons.<clinit>(AllIcons.java:670)
at com.intellij.icons.AllIcons$Nodes.<clinit>(AllIcons.java:719)
at com.intellij.ide.ui.laf.IdeaLaf.initIdeaDefaults(IdeaLaf.java:74)
at com.intellij.ide.ui.laf.IdeaLaf.initComponentDefaults(IdeaLaf.java:35)
at java.desktop/javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:150)
at java.desktop/javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1560)
at com.intellij.idea.StartupUtil.lambda$scheduleInitUi$21(StartupUtil.java:476)
at com.intellij.ui.scale.JBUIScale.computeSystemFontData(JBUIScale.java:69)
at com.intellij.ui.scale.JBUIScale.getSystemFontData(JBUIScale.java:360)
at com.intellij.idea.StartupUtil.lambda$scheduleInitUi$22(StartupUtil.java:474)
at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:783)
... 14 more
-----
Your JRE: 11.0.13+0-b1751.21-8125866 amd64 (JetBrains s.r.o.)
D:\Program Files\Android\Android Studio\jre
環境刷新
build.gradle(project) Update at 2021.8.20
buildscript {
ext.kotlin_version = '1.5.21'
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
<activity android:name=".MainActivity" android:exported="true">
<intent-filter>
...
</intent-filter>
</activity>
android {
viewBinding {
enabled = true
}
}
plugins {
id 'com.android.application'
id 'kotlin-android'
}
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
...
}
import kotlinx.android.synthetic.main.activity_main.*
import com.example.helloandroid.databinding.ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
...
}
override fun onCreate(savedInstanceState: Bundle?) {
...
tapHere.setOnClickListener {
textView.text = "ボタンがタップされました"
}
}
↓override fun onCreate(savedInstanceState: Bundle?) {
...
binding.tapHere.setOnClickListener {
binding.textView.text = "ボタンがタップされました"
}
}
private var _binding: ResultProfileBinding? = null
// This property is only valid between onCreateView and
// onDestroyView.
private val binding get() = _binding!!
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = ResultProfileBinding.inflate(inflater, container, false)
val view = binding.root
return view
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
name.text = viewModel.name
button.setOnClickListener { viewModel.userClicked() }
↓binding.name.text = viewModel.name
binding.button.setOnClickListener { viewModel.userClicked() }
val fragment = TitleFragment()
fragment.setTitle("フラグメント動物図鑑")
val fragmentManeger = this.supportFragmentManager
supportFragmentManager.commit {
replace(R.id.fragmentContainerView, fragment)
addToBackStack("name") // name can be null
}
dependencies {
...
implemetation 'androidx.preference:preference-ktx:1.1.0'
...
}
class MyAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(fm){
...
override fun getCount(): Int {
...
}
}
class MyAdapter(fa: FragmentActivity) : FragmentStateAdapter(fa){
...
override fun getItemCount(): Int {
...
}
}
binding.pager.adapter = MyAdapter(supportFragmentManager)
↓binding.pager.adapter = MyAdapter(this)
var handler = Handler()
↓Looper.prepare()
val handler = Looper.myLooper()?.let { Handler(it, null) }
timer(period = 5000){
handler.post {
...
}
}
↓timer(period = 5000){
handler?.post {
...
}
}
override fun onActivityCreated(...){
...
}
↓override fun onViewCreated(...){
...
}
soundPool = SoundPool.Builder()
.setMaxStreams(1)
.setAudioAttributes(audioAttributes)
.build()
buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.1"
classpath "io.realm:realm-gradle-plugin:10.7.0"
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
plugins {
id 'kotlin-kapt'
id 'realm-android'
}
...
realm {
syncEnabled = true
}