안드로이드 어플에서 전화수신 팝업 기능을 테스트 해보고자 검색해보니 http://gun0912.tistory.com/46 에 자료가 있다.
코드를 받아서 보니 Butter Knife 라이브러리를 사용했더라.
한번도 사용을 해보지 않은 거라 그런지 소스코드를 붙여넣기 하니 에러가 발생한다.
검색으로 찾아보니 이 분 블로그에 방법이 나온다.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:support-annotations:24.2.0'
compile 'com.google.firebase:firebase-messaging:9.6.1'
// butterknife 추가해주는 것만으로 알아서 import 해 줌
compile 'com.jakewharton:butterknife:7.0.1'
}
이렇게 하고 나면 Sync Now 를 눌러줘야 한다.
CallingService.java 파일내에 코드에서 에러가 해결되지 않는 곳이 있다.
@InjectView(R.id.tv_call_number) TextView tv_call_number;
ButterKnife.inject(this, rootView);
import butterknife.InjectView;
부분을 인식할 수 없다고 나온다.
문제 해결을 위해서 구글링을 해보니 http://jakewharton.github.io/butterknife/ 에서 확인하라고 나온다.
버전이 높아지면서 기능이 변경되었다는 걸 알 수 있었다.
compile 'com.jakewharton:butterknife:8.5.1'
기 존 |
수 정 |
@InjectView(R.id.tv_call_number) TextView tv_call_number; | @BindView(R.id.tv_call_number) TextView tv_call_number; |
ButterKnife.inject(this, rootView); |
ButterKnife.bind(this, rootView); |
Gradle 에 버전을 수정해주고 코드를 수정하고나서 에러 메시지가 없어졌다.
이제 컴파일하여 코드를 테스트하는데 코드가 비정상적으로 동작하면서 죽는다.
원인이 정확하게 해결되지 않았나 보다..
원인 해결되면 수정 정리해야겠다.
'안드로이드 > 버그탈출' 카테고리의 다른 글
setlatesteventinfo() is deprecated (0) | 2017.04.05 |
---|---|
Android Studio ITelephony.aidl (not .java) (0) | 2017.04.03 |
LG G5 개발자 모드 설정(USB 디버깅) (4) | 2017.03.29 |
Android 6.0 이상 권한 오류 해결방법 (0) | 2017.03.24 |
단체문자(동보) 발송한도 (0) | 2017.03.01 |