카테고리 없음

스토어 정지 먹어서 시작한 앱만들기

gregoryz 2023. 4. 25. 17:33
반응형

 

https://jeonssi.github.io/personality_test/

 

성격유형(personality type)Test Disc (Dominance,Influence,Steadiness,Conscientiousness)

성격테스트(disc) ※ 각 행당 하나만 선택해 주세요(4개중 택 1)

jeonssi.github.io

 

성격유형 테스트 앱을 만들어 보았다.

 

 

전체 과정

1)깃허브 가입

2) 앱 만들기 : html, javascript, CSS(부트스트랩)

3) 깃허브에서 앱실행하기 (위의 주소창처럼 잘 나온다)

4) 구글 스토어에 Webview로 올리기 (kotlin 사용)

 

 

안드로이드를 오픈하 때 정말 힘들고 귀찮다고 생각했다

 

디자인 작업(미리캔버스), 코딩 작업 (kotlin) - 결과물 마음에 들지 않음 T.T

 

 

복붙 했는데 촌스러움

 

이런 이미지들을 넣었다.

 

 

 

간단한 코드 소개

 

 

 

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/disc_foreground"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Web3disc"
        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>
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="발급 받은 아이디 입력"/>
    </application>

</manifest>

 

 

위에 코드가 하나 빠졌는데 퍼미션을 넣어줘야 한다

<uses-permission android:name="android.permission.INTERNET"/>

 

 

 

그리고 build.gradle(Molule :app)에

 

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

android {
    namespace 'discw.disc.myapplication'
    compileSdk 33

    defaultConfig {
        applicationId "discw.disc.myapplication"
        minSdk 24
        targetSdk 33
        versionCode 2
        versionName "2.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.8.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    implementation 'com.google.android.gms:play-services-ads:21.0.0'
}

 

 

 

맨 아래 코드 추가

 

implementation 'com.google.android.gms:play-services-ads:21.0.0'

 

 

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">

    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    <com.google.android.gms.ads.AdView
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        ads:layout_constraintStart_toStartOf="parent"
        ads:layout_constraintEnd_toEndOf="parent"
        ads:layout_constraintBottom_toBottomOf="parent"
        ads:adSize="BANNER"
        ads:adUnitId="발급받은 아이디 입력">
    </com.google.android.gms.ads.AdView>

</androidx.constraintlayout.widget.ConstraintLayout>

 

 

구글 애드몹 , 웹뷰 추가

 

구글 애드몹 설치 법(?)은 홈페이지에 검색하면 자세히 나와 있었다....

 

복붙 하면 된다

 

MainActivity.kt로 와서

 

 

package discw.disc.myapplication

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.webkit.WebView
import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.AdView
import com.google.android.gms.ads.MobileAds

class MainActivity : AppCompatActivity() {

    lateinit var mAdView : AdView
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        MobileAds.initialize(this) {}
        mAdView = findViewById(R.id.adView)
        val myWebView: WebView = findViewById(R.id.webview)

        myWebView.settings.javaScriptEnabled = true
        myWebView.loadUrl("웹뷰로 띄울 주소 입려해 주세요")

        val adRequest = AdRequest.Builder().build()
        mAdView.loadAd(adRequest)
    }
}

 

 

 

코드는 정말 간단하다.

 

그런데 욕심부려 한번에 IOS, 안드로이드 코딩하려고 플루터로 했다가 안되더라....

 

그냥 되는 거 먼저 해야겠다 해서 코틀린으로 함

 

 

그리고 apk 추출해야 하는데

 

요거 클릭

 

앱스토어에서 번들로 올리라고 하더라

 

 

 

클릭클릭 계속하면

 

 

앱이 생긴다

 

apk로 생성하면 아래 두 개가 나오고

번들로 생성하면 맨 위에. aab 파일이 나온다

 

 

이제 구글 스토어에 올리면 끝이다.

 

나는 머리가 나빠서 하루 종일 걸렸다.... 아직 심사 중....

 

 

파이팅!!!!!!!!

반응형