반응형
안드로이드
AndroidManifest.xml
uses-permission 코드 한 줄 추가 = internet 권한
android:usesCleartextTraffic="true" 추가
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"/>
<application android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Test"
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity android:name=".MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
activity_main.xml
androidx.constraintlayout.widget.ConstraintLayout => LinearLayout으로 변경
TextView => Webview로 내용까지 변경.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<WebView android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
MainActivity.java
package com.example.test;
import android.os.Bundle;
import android.webkit.WebView;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
public class MainActivity extends AppCompatActivity {
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView = findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setMediaPlaybackRequiresUserGesture(false);
webView.loadUrl("Https://www.google.com");
}
}
우측에 뜨는 모바일 가상 화면이 너무 느려서 변경
pixel 8 - nugget 24 다운로드
변경하니까 금방 열린다.
Image Asset
배포하기
Build APK
aab 생성
경로 : C:\Users\user\AndroidStudioProjects\Test\app\release
반응형
'개발 공부 Today I Learned' 카테고리의 다른 글
[국비 81일차 TIL] GeoServer 시도, 시군구, 법정동 구역 구분하기 (0) | 2024.03.20 |
---|---|
[국비 80일차 TIL] geoserver 시작하는 방법 (0) | 2024.03.19 |
[국비 78일차 TIL] geoserver, docker 설치 (0) | 2024.03.15 |
[국비 77일차 TIL] JPA 생성 CRUD (0) | 2024.03.14 |
[국비 76일차 TIL] 공공데이터포털 API, jsoup, JPA (0) | 2024.03.13 |
댓글