kangsudal / whats_for_dinner

1 stars 1 forks source link

노트북으로 실행시키면 안됨 #23

Closed kangsudal closed 1 year ago

kangsudal commented 1 year ago
FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:processDebugManifest'.
> Failed to query the value of task ':app:processDebugManifest' property 'mainMergedManifest'.
   > Could not create task ':app:processDebugMainManifest'.
      > java.lang.NullPointerException (no error message)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
Exception: Gradle task assembleDebug failed with exit code 1
kangsudal commented 1 year ago

https://commin.tistory.com/4

kangsudal commented 1 year ago

새 프로젝트를 만들어 lib에 있는 파일들을 복붙해보았다.

Exception when attempting to compute the file changes for the file move: Server error: type 'Null' is not a subtype of type 'CompilationUnitElementlmpl'in type cast"

라는 에러메시지가 나왔다.

kangsudal commented 1 year ago

https://github.com/kangsudal/whats_for_dinner/commit/3abdcbbd7d0b16c80e00f08e6ec0e30d05ad29d7

이부분에서 에러가 난것이다.

def googleMapsApiKey = keystoreProperties.getProperty('google.maps.apiKey') manifestPlaceholders += [googleMapsApiKey: googleMapsApiKey]

       <meta-data android:name="com.google.android.geo.API_KEY"
           android:value="${googleMapsApiKey}"/>

위를 지우고 manifest에서 googleapikey를 그대로 넣어주면 작동한다

kangsudal commented 1 year ago

https://steemit.com/kr/@etainclub/google-map-api-key

https://developer.android.com/studio/build/manifest-build-variables

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

...

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

def googleMapsApiKey = keystoreProperties.getProperty('google.maps.apiKey')

로 되어있었다. def googleMapsApiKey = keystoreProperties.getProperty('google.maps.apiKey')에서 keystoreProperties를 localProperties로 바꾸어주니 해결되었다.

kangsudal commented 1 year ago

데스크탑에서 됐던 이유는 local.properties가 아닌 key.properties에 apikey 데이터가 있었기 때문이다.

apikey 데이터의 이동 local.properties 파일의 google.maps.apiKey

-> android/app/build.gradle의 localProperties

-> def googleMapsApiKey = localProperties.getProperty('google.maps.apiKey')

-> manifestPlaceholders += [googleMapsApiKey: googleMapsApiKey]

-> AndroidManifest.xml의 ${googleMapsApiKey}