• 카테고리

    질문 & 답변
  • 세부 분야

    모바일 앱 개발

  • 해결 여부

    미해결

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

23.05.22 21:57 작성 23.05.22 22:02 수정 조회수 472

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) 뜹니당

답변 2

·

답변을 작성해보세요.

0

II님의 프로필

II

질문자

2023.05.23

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

// 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은 다 같습니다.

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

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

 

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

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

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

 

 

II님의 프로필

II

질문자

2023.05.23

  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 위에 경고가 뜹니다

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

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

0

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

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