: 아래와 같은 코틀린 코드를 java 코드로 변환해 봤습니다.
class MainActivity2 : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
RC100_APPTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
) {
Greeting("Android")
}
}
}
}
}
@Composable
fun Greeting(name: String) {
Text(text = "Hello $name!")
}
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
RC100_APPTheme {
Greeting("Android")
}
}
▶ Tools 메뉴 Kotlin ==> "Show Kotlin Bytecode" 선택
▶ 아래의 Kotlin Bytecode 메뉴에서 Decompile를 클릭해 줍니다.
▶ XXXXXXX.decompiled.java 파일이 생성이 됩니다. ( MainActivity2.decompiled.java)
// MainActivity2.java
package com.xxx.rc100_app;
import android.os.Bundle;
import androidx.activity.ComponentActivity;
import androidx.activity.compose.ComponentActivityKt;
import androidx.compose.runtime.CompositionContext;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import org.jetbrains.annotations.Nullable;
@Metadata(
mv = {1, 6, 0},
k = 1,
d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0012\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u0006H\u0014¨\u0006\u0007"},
d2 = {"Lcom/xxx/rc100_app/MainActivity2;", "Landroidx/activity/ComponentActivity;", "()V", "onCreate", "", "savedInstanceState", "Landroid/os/Bundle;", "app_debug"}
)
public final class MainActivity2 extends ComponentActivity {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ComponentActivityKt.setContent$default(this, (CompositionContext)null, (Function0)null.INSTANCE, 1, (Object)null);
}
}
import androidx.compose.material.TextKt;
import androidx.compose.runtime.Composable;
import androidx.compose.ui.Modifier;
import androidx.compose.ui.text.TextStyle;
import androidx.compose.ui.text.font.FontFamily;
import androidx.compose.ui.text.font.FontStyle;
import androidx.compose.ui.text.font.FontWeight;
import androidx.compose.ui.text.style.TextAlign;
import androidx.compose.ui.text.style.TextDecoration;
import com.xxx.rc100_app.ui.theme.ThemeKt;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
@Metadata(
mv = {1, 6, 0},
k = 2,
d1 = {"\u0000\u0010\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\u001a\b\u0010\u0000\u001a\u00020\u0001H\u0007\u001a\u0010\u0010\u0002\u001a\u00020\u00012\u0006\u0010\u0003\u001a\u00020\u0004H\u0007¨\u0006\u0005"},
d2 = {"DefaultPreview", "", "Greeting", "name", "", "app_debug"}
)
public final class MainActivity2Kt {
@Composable
public static final void Greeting(@NotNull String name) {
Intrinsics.checkNotNullParameter(name, "name");
TextKt.Text-Vh6c2nE$default("Hello " + name + '!', (Modifier)null, 0L, 0L, (FontStyle)null, (FontWeight)null, (FontFamily)null, 0L, (TextDecoration)null, (TextAlign)null, 0L, 0, false, 0, (Function1)null, (TextStyle)null, 65534, (Object)null);
}
@Composable
public static final void DefaultPreview() {
ThemeKt.RC100_APPTheme$default(false, (Function0)null.INSTANCE, 1, (Object)null);
}
}
그럼 수고하세요.
반응형
'Android_app' 카테고리의 다른 글
[JetPack Compose] Surface (0) | 2022.11.16 |
---|---|
[Android Studio ] 스마트폰 화면 스크린 캡쳐 하기 (0) | 2022.11.15 |
[Android Studio] Build Error (0) | 2022.11.01 |
[Android Studio] Unsupported Git Version 2.XX.X (0) | 2022.06.15 |
Android-nRF-Toolbox 빌드 에러(versionCode :-1) (0) | 2022.06.15 |