마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

build하면 NotNull 이 계속 같은게 import 됩니다 jetbrains

0 추천

build 누르면 자동으로 생성되는 코드 중에 

\AndroidStudioProjects\apollographql01\app\build\generated\source\apollo\classes\debug\com\mytube\apollographql01\SayByeQuery.java

import org.jetbrains.annotations.NotNull;

이게 계속 생기는데 이것을 바꾸고 싶어요

schema.json, .graphql 을 넣고 build를 누르면 자동으로 sayByeQuery.java 를 만들어 주고 있는데, 저기 NotNull이 계속 문제였습니다.

(여러가지를 손대서 지금은 그 메시지를 못 띄우겠네요)

 

핵심 질문.

build를 누르면 자동 생성되는 코드에서 @NotNull을 다루는 것을 바꾸는 방법을 알면 해결할 것 같은데 알려주세요. (jetbrains.annotations.NotNull -> android.annotation.NonNull)

자동 생성된 결과물에서 android.annotation을 import 하려해도 안됩니다. 해도 어차피 새로 생성될때 덮어써지고요.

해결방법이나 검색 키워드를 도와주시면 정말정말 감사하겠습니다.

 

서버는 잘 동작하는데, apollo-android로 client단 만들다가 Query문을 Java문으로 자동으로 변경해줄때 문제가 생깁니다.

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.apollographql.apollo:apollo-runtime:1.2.1'
    implementation "com.apollographql.apollo:apollo-android-support:1.0.0"
    implementation 'com.squareup.okhttp3:okhttp:3.0.1'
    // For @Nullable/@NonNull
//    implementation 'com.android.support:support-annotations:+'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'org.jetbrains:annotations-java5:15.0'

 

지금까지 해본 것

1.

annotation을 jetbrains 말고 android 제공되는 것으로 바꿔봤습니다.

구글링에서는 된다는데, 저는 다른 상황인지 자꾸 jetbrains가 import 됩니다.

2.

settings -> Inspections -> java/Probable bugs/ 

"Constant conditions & exceptions" , "@NotNull/@Nullable problems"

2가지 각각 annotation 을 android.support.annotation.Nullable/ NonNull   ,android.annotation.Nullable/NonNull

2가지 조합으로 모두 시도해봤습니다.

 

이것 저것 손대다가 생긴 문제..

jetbrains..annotation이 13.0 15.0 2개나 적용된 것 같은데

13.0은 찾아 볼 수가 없는데, 어디서 갑자기 나온건지 모르겠어요.

NotNull 문제만 해결 되면 새로 프로젝트를 만들어서라도 잘 됐으면 좋겠네요.

초보의 글을 여기까지 읽어주셔서 감사합니다.

 

Duplicate class org.intellij.lang.annotations.Flow found in modules annotations-13.0.jar (org.jetbrains:annotations:13.0) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.Identifier found in modules annotations-13.0.jar (org.jetbrains:annotations:13.0) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants found in modules annotations-13.0.jar (org.jetbrains:annotations:13.0) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$AdjustableOrientation found in modules annotations-13.0.jar (org.jetbrains:annotations:13.0) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$BoxLayoutAxis found in modules annotations-13.0.jar (org.jetbrains:annotations:13.0) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$CalendarMonth found in modules annotations-13.0.jar (org.jetbrains:annotations:13.0) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$CursorType found in modules annotations-13.0.jar (org.jetbrains:annotations:13.0) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$FlowLayoutAlignment found in modules annotations-13.0.jar (org.jetbrains:annotations:13.0) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
 

 

익명사용자 님이 2019년 11월 20일 질문

1개의 답변

0 추천

자답입니다.

삽질하다가 그냥 프로젝트를 공식문서를 기준으로 새로 만들고, 다시 해보니 잘 작동하네요 ;;

아래는 공식문서 내용입니다.

한번에 못해서 추가/추가/수정/수정하다가 뭐가 잘못된줄도 모르겠습니다.ㅎㅎ;

새로 다시 만드는 것도 중간에 여러번 반복했었는데, 그동안 짜여진것을 공식문서 기준으로 다시 해보니 좀 우여곡절끝에 결국 원하는 응답을 받아냈네요..

이제 편하게 누워 쉴 수가 있겠네요 ㅎㅎㅎ

apply plugin: 'com.apollographql.android'

repositories {
    jcenter()
}

dependencies {
  implementation("com.apollographql.apollo:apollo-runtime:x.y.z")
  
  // If not already on your classpath, you might need the jetbrains annotations
  compileOnly("org.jetbrains:annotations:13.0")
  testCompileOnly("org.jetbrains:annotations:13.0")
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation("com.apollographql.apollo:apollo-runtime:1.2.1")
    implementation 'com.squareup.okhttp3:logging-interceptor:3.8.1'
    // If not already on your classpath, you might need the jetbrains annotations
    compileOnly("org.jetbrains:annotations:13.0")
    testCompileOnly("org.jetbrains:annotations:13.0")
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
익명사용자 님이 2019년 11월 21일 답변
...