본문 바로가기

안드로이드30

non-zero exit value Multidex Error 신나게 코딩하다 빌드하려하면 with non-zero exit value 가 포함된 에러가 나올 때가 있다. Full Exception은 다음과 같다. Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished with non-zero exit .. 2016. 3. 8.
photoview library 우리가 흔히 사진에 줌 기능을 넣을 때 쓰는 라이브러리가 chrisbanes 의 PhotoView다. https://github.com/chrisbanes/PhotoView 사용을 위해 간편하게 디펜던시에 추가하면 끝 compile 'com.commit451:PhotoView:1.2.4' 사용법도 간편하다 ImageView iv = (ImageView) findViewById(R.id.imageView); Drawable bitmap = getResources().getDrawable(R.drawable.wallpaper); iv.setImageDrawable(bitmap); PhotoViewAttacher mAttacher = new PhotoViewAttacher(mImageView);ImageVie.. 2016. 3. 8.
구글맵 사용하기 이전에 구글맵은 LocationManager를 이용하여 gps와 network를 비교하며 사용했다.이 과정이 복잡하고 처리도 늦어 구글에서 대대적인 개혁을 했으니.바로 GoogleApiClient를 이용하여 서비스 한다. 이전의 처리방법LocationManager locationManager = (LocationManager) context.getSystemService(Activity.LOCATION_SERVICE); boolean isGpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); boolean isNetworkEnabled = locationManager.isProviderEnabled(LocationMana.. 2016. 2. 24.
Goolgle map api 설정 1. 구글 개발자 콘솔 접속https://console.developers.google.com/ 2. 로그인 후 우측 상단의 표시부분을 클릭 3. 새 프로젝트 생성 4. 생성 후 이동된 화면에서 api 사용설정 클릭 5. googlmap android api 클릭 6. api 사용 enable 클릭 7. 좌측메뉴의 사용자 인증정보 탭 클릭을 하면 아래의 화면이 보인다.Create credentials 클릭 후 api키 선택 8. Android 키 클릭 9. 이름에는 구분할 수 있는 이름으로 명시해주고 아래 패키지명과 SHA-1 인증서 지문을 적는다.이 때 두개를 입력해야 하는데, 하나는 디버그용 하나는 build용이다. - 인증서 지문 얻는 방법 http://akaisun.tistory.com/admin.. 2016. 2. 21.
SHA-1 인증서 지문구하기 - The way getting the SHA1 우리가 흔히 구글맵 등의 api를 사용하기 위해서는 sha1 인증서 등을 구해야 할 경우가 종종 있다.- Sometimes we need sha1 when using google api debug키를 기준으로 설명하겠다.- i will explain based on debug key 우선 cmd창을 띄우자.- first, open the cmd window 윈도우의 시작버튼을 누르고 검색창에 cmd라 적는다.- press window key, input cmd into the search box 창의 띄워지면 인증서가 있는 해당폴더로 이동한다.- and then, move the folder that contains debugkey file. keytool -list -v -keystore debug.k.. 2016. 2. 21.
내 주변의 와이파이 목록 가져오기 The Way to Scan Wifi List 내 주변의 와이파이의 목록을 가져오는 법 1. WifiManager를 선언wifiManager = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE); 2. IntentFilter를 선언하여 Receiver를 등록IntentFilter intentFilter = new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); getContext().registerReceiver(receiver, intentFilter); 3. Rec.. 2016. 2. 21.
Decompile - 디컴파일 Decompile을 하는 이유는 간단하다. 소스를 보기 위해서.... apk파일을 열어보면 xml은 깨져있고 java파일은 보이지도 않는다.소스를 보기 위해서는 어떻게 해야할까?알고있는 몇가지를 포스팅해본다. - dex2jar https://github.com/pxb1988/dex2jar실행파일을 미러사이트에서 받으면 된다. 압축을 풀면 위와 같은 파일들을 볼 수 있다. 다음으로 apk에서 classes.dex파일을 추출하여 위 폴더에다 넣는다. 해당 폴더의 경로에서 d2j-dex2jar.bat classes.dex 를 입력하면 dex파일을 jar파일로 변환시켜준다. 변환된 jar파일의 압축을 풀면 java파일을 볼수가 있다. - smali2java dex2jar에 GUI까지 더해진 것이라 생각하면 된다.. 2016. 2. 10.
Resource 배열처리 작업을 하다보면 string, integer와 같은 resource들을 나열해서 쓸때가 있다.나열된 resource들은 코드를 복잡하게 만드는 주범이다. 이때 array를 이용하여 처리한다면 깔끔하게 처리할 수 있다. 다음과 같이 알기 쉽게 array라는 xml파일에 작업하도록 하겠다. array는 string , integer, drawable 등 다양한 형태로 추가 가능하다. test1 test2 test3 test4 1 2 3 4 @drawable/ic_place_white_24dp @drawable/ic_local_hotel_white_24dp 꺼내 쓰는 방법은 다음과 같이 하면된다.여기서 drawble은 TypedArray를 써서 담아야 한다. String[] strList = getResour.. 2016. 2. 9.
안드로이드 비디오 재생하기 안드로이드에서 비디오를 재생하는 방법은 두가지다. 하나는 원격지 서버에서 스트림으로 받아와 재생하는 방법또 하나는 로컬에 있는 매체를 재생하는 방법 다양한 재생방법과 라이브러리가 있겠지만 가장 기본적인 방법은 아래와 같다. VideoView videoView = (VideoView) findViewById(R.id.vidieo); MediaController controller = new MediaController(this); controller.setVisibility(View.GONE); videoView.setMediaController(controller); videoView.setOnCompletionListener(completionListener); //로컬 videoView.setVide.. 2016. 2. 6.