inflearn logo
강의

Khóa học

Chia sẻ kiến thức

[Phiên bản cơ bản] Tạo ứng dụng cộng đồng Android (Android Kotlin)

Triển khai đăng ký thành viên Firebase

java랑 auth가 import가 안됍니다 도와주세요

677

II

3 câu hỏi đã được viết

0

그리고 오류 메세지는

Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [com.google.firebase:firebase-analytics-ktx:21.2.2] C:\Users\wjddl\.gradle\caches\transforms-3\7becfc46b58d8ce50cecb97897d4c456\transformed\firebase-analytics-ktx-21.2.2\AndroidManifest.xml as the library might be using APIs not available in 16

Suggestion: use a compatible library with a minSdk of at most 16,

or increase this project's minSdk version to at least 19,

or use tools:overrideLibrary="com.google.firebase.analytics.ktx" to force usage (may lead to runtime failures) 뜹니당

android kotlin firebase

Câu trả lời 2

0

II

제가 깃허브를 사용을 안해봐서

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        // Make sure that you have the following two repositories
        google()  // Google's Maven repository

        mavenCentral()  // Maven Central repository

    }
    dependencies {
        def nav_version="2.3.5"
        // Add the dependency for the Google services Gradle plugin
        classpath 'com.google.gms:google-services:4.3.15'
        classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version")

    }
}




plugins {
    id 'com.android.application' version '7.1.0-rc01' apply false
    id 'com.android.library' version '7.1.0-rc01' apply false
    id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

 

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'com.google.gms.google-services'
}

android {
    compileSdk 33

    defaultConfig {
        applicationId "com.example.mysolelife"
        minSdk 16
        targetSdk 33
        versionCode 1
        versionName "1.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'
    }

    dataBinding {
        enabled true
    }
}




dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.9.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.firebase:firebase-analytics-ktx'

    implementation platform('com.google.firebase:firebase-bom:31.5.0')
    implementation 'com.google.firebase:firebase-auth-ktx'
    implementation 'com.google.android.gms:play-services-auth:20.5.0'

}

그래들 부분만 가져왔습니다. 다른 xml은 다 같습니다.

0

bokchi

minSdk 를 19로 변경하고 우측 상단에 Sync Now를 누르고 나서 다시 시도해보시겠어요?

안된다면 아래의 정보도 함께 알려주세요. (스크린샷과 코드로 자세히 알려주세요.

 

  1. google-service.json을 어떻게 넣으셨나요?

  2. 프로젝트를 생성하시고 아무 코드도 작성하지 않고 실행했을 때는 실행이 잘 되나요?

  3. 강의 어디까지는 잘 되셨는데 어디부터 안되기 시작하신건가요?

 

 

0

II

  1. google-service.json을 안드로이드를 눌러 프로젝트로 바꾼 후 앱에 넣었습니다.

  2. 프로젝트는 firebase 세팅구현 전까지는 작동 잘됐습니다.

  3. 안돼고 있는 부분은 Firebase 회원가입 구현중 그래들 건드리는 부분과 Import 부분중 class.java 및 Firebase.auth 가 Import가 안돼고 있습니다. 그리고 그래들에서 min16 -> 19로 변경했습니다 그래들을 Syns를 했을경우 오류는 나지 않았습니다.

package com.example.mysolelife

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import com.example.mysolelife.auth.introActivity

class SplashActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {

        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_splash)

        Handler().postDelayed({
            startActivity(Intent(this, introActivity::class.java))
            finish()
        }, 3000)
    }
}
package com.example.mysolelife.auth

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import com.example.mysolelife.R
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.ktx.Firebase

class JoinActivity : AppCompatActivity() {

    private lateinit var auth: FirebaseAuth

    override fun onCreate(savedInstanceState: Bundle?) {

        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_join)

        auth = Firebase.auth

        auth.createUserWithEmailAndPassword("abc@abc.com", "abcdabcd")
            .addOnCompleteListener(this) { task ->
                if (task.isSuccessful) {
                    // Sign in success, update UI with the signed-in user's information

                    Toast.makeText(this, "성공", Toast.LENGTH_LONG).show()


                } else {
                    // If sign in fails, display a message to the user.

                    Toast.makeText(this, "실패", Toast.LENGTH_LONG).show()

                }
            }
    }
}

이 부분이 오류가 뜨며

오류내용은 Caused by: org.jetbrains.kotlin.gradle.tasks.CompilationErrorException: Compilation error. See log for more details 이것입니다.

또한 Some kotlin libraries attached 위에 경고가 뜹니다

0

bokchi

uyalae@naver.com 으로 프로젝트를 압축해서 보내주세요.

며칠내로 확인 후 회신드리겠습니다.

0

bokchi

build.gradle에 minSdk 를 19로 올려보시겠어요?

잘 안되시면 전체 코드를 깃허브에 올리시고 링크 공유해주세요.

이미지가 기본이미지인지 확인

0

127

1

NavController error 발생

0

138

1

fragment 생성하고 메인에서 불러왔는데 안뜹니다.

0

136

2

67강 댓글

0

94

2

7강 데이터바인딩 에러

0

110

2

Firebase 스토리지 유료화 문제

1

290

2

게시글 이미지가 파이어베이스에 저장되지 않습니다.

0

178

2

AVD 갤러리에 이미지 저장 안되는 문제

0

237

2

이미지 받아오는 방법?

0

200

2

회원탈퇴 기능을 추가하려고 합니다.

0

185

2

상태바 질문 드립니다.

0

107

1

섹션2 인트로 페이지 꾸미기 질문 드립니다.

0

107

1

게시판 글을 길게 쓸경우

0

121

2

로그인 로그아웃

0

173

2

갤럭시 연결시 게시판에 업로드한 사진이 보이지 않아요.

0

199

2

웹뷰 AVD 실행안됨

0

188

1

자막켜기가 안되요 ㅜ.ㅜ

1

183

1

리사이클러뷰, 그리드레이아웃 오류

0

184

2

리사이클러뷰 오류 해결 방법이 궁금합니다.

0

192

1

firebase 스마트폰으로 연결이 안되는데 원인이 있을까요

0

253

2

안드로이드 스튜디오 게시글 이미지 업로드 유무

0

212

1

firebase 설정 오류

0

293

2

홈 화면 커뮤니티

0

173

1

게시판 글 읽기

0

234

2