라이브러리를 배포했었는데 갑자기 AndroidStudio에서 해당 라이브러리를 Import한 후에 빌드가 안된다는 문의가 들어왔다.


Error:Execution failed for task ':{project_name}:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't read [{project_name}\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar] (Can't process class [{library_name}/b.class] (Unknown verification type [255] in stack map frame))



이전에 잘 동작했었는데 갑자기 이런 문제가 발생해서 당황했다.


Google 검색을 해보니 Proguard의 소스를 변경해서 다시 컴파일 하라는둥. 

MultiDex설정을 바꾸라는둥 여러가지 말들이 많이 있었다.



 우선 배포했던 JAR를 프로가드 돌리지 않고 Android Studio에서 테스트 해보니 정상적으로 빌드가 되었다.


 그래서 프로가드 문제가 확실하다고 판단하여 옵션을 살펴봤는데 크게 바꿀만한 내용이 없는것이였다.


결론은 프로가드 버전이 낮아서 SDK를 난독화 할때 뭔가 잘못 동작을 했던것 같다.


이제서야 개발용 컴퓨터가 기존이랑 바뀌었다는것을 인지하게 되었다.





프로가드 사이트 (버전 확인) : http://proguard.sourceforge.net


{android_sdk}/tools/proguard  를 최신 벋전으로 변경해서 다시 난독화를 진행하니 빌드가 잘되었다.



블로그 이미지

날기억해

Android / IOS / PHP / System Engineer / Service Architecture/ MongoDB / AWS / Mysql / Linux / Python / C++ / Vue.js / node.js / Java / Iot / BLE / Firebase / Bigdata Architecture / AD Server / SDK / Epub /

,
후.. 한참을 헤맸다.

예전에 작업 했언던 적이 있었는데 따로 정리를 안해놔서 삽질 엄청 했다.


우선 Android Studio에서는 모듈 난독화를 쉽게 설정이 가능했는데 어쩌다보니 이클립스에서 해야 하는 일이 생겼다.


Library Project는 빌드시에 동작하는 proguard-project.txt 가 먹히질 않는다.


그래서 따로 jar파일을 만든 후에 proguard를 따로 돌려줘야 한다.


1. Export Jar

2. {sdk_home}\tools\proguard\bin\proguardgui.bat

3. 저장했던 configure가 있다면 로딩해오면 좋다.


일단 대충 항목을 설명해야 겠다.

내가 헤맸던 부분은 바로 이 부분이였다.



-injars : 난독화할 jar 경로

-outjars : 결과물 경로

-libraryjars : 프로젝트에서 참조하고 있는 jar 파일

ex)

      -libraryjars 'C:\Android\sdk\platforms\android-23\android.jar'

-libraryjars 'C:\workspace\myproject\libs\android-support-v4.jar'

-libraryjars 'C:\workspace\myproject\libs\google-play-services.jar'

-libraryjars 'C:\Android\sdk\platforms\android-23\optional\org.apache.http.legacy.jar'




기존 proguard-project.txt 상단에 저 옵션을 추가한후 

load configuration을 하면 쉽게 설정이 가능하다.

추가로 {sdk_home}\tools\proguard\examples\android.pro 를 보면 프로가드에 대한 옵션을 볼수 있다. 






추가로 javascript가 동작하지 않았다.




I copy my answer from this topic for you: http://stackoverflow.com/a/19994873/1735499

And, if you are using Proguard, remember to add this

-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}

-keepattributes JavascriptInterface
-keep public class com.mypackage.MyClass$MyJavaScriptInterface
-keep public class * implements com.mypackage.MyClass$MyJavaScriptInterface
-keepclassmembers class com.mypackage.MyClass$MyJavaScriptInterface { 
    <methods>; 
}

If it's still not OK, add this

-keepattributes *Annotation*

Note: your MyJavaScriptInterface must be Public class

Ref#: Android Proguard Javascript Interface Fail

Br,

Frank



블로그 이미지

날기억해

Android / IOS / PHP / System Engineer / Service Architecture/ MongoDB / AWS / Mysql / Linux / Python / C++ / Vue.js / node.js / Java / Iot / BLE / Firebase / Bigdata Architecture / AD Server / SDK / Epub /

,

SVN에 권한을 모두 줬는데도


업데이트는 되는데 Commit이 안되는 경우가 있어서 헤매다 보니..


SVN레파지토리에 설정된 폴더가 대문자였으나. 소문자로 접근해서 사용하니 해당 문제가 발생하였다..



블로그 이미지

날기억해

Android / IOS / PHP / System Engineer / Service Architecture/ MongoDB / AWS / Mysql / Linux / Python / C++ / Vue.js / node.js / Java / Iot / BLE / Firebase / Bigdata Architecture / AD Server / SDK / Epub /

,

Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536


처음에 위의 메세지와 함께 빌드가 안됐을때 얼마나 당황했는지 모른다. 

Facebook SDK와 Google Play와 아마존 SDK를 넣었더니 금세 65535개의 메소드가 초과했다면서 빌드가 되지 않는 것이다.


구글 플레이의 jar를 수정하여 안쓰는 모듈을 제거하고 사용하는 방법등 여러가지 삽질을 했지만.

결론부터 말하면 가장 좋은 방법은 Multi Dex를 이용하는 방법이다.


이 방법을 사용하는 방법에는 2가지가 있는 듯한데... 

1가지는 안드로이드 스튜디오를 사용하면 빌드 스크립트를 수정하여 android.support의 multidex 라이브러리를 이용하는것 인것 같다.(http://blog.osom.info/2014/10/multi-dex-to-rescue-from-infamous-65536.html) 

하지만 나는 안드로이드 스튜디오보다는 이클립스에 익숙하기 때문에 위의 방법을 선탁하지는 않았다. 사실 위의 방법이 가장 좋은것 같다.


그래서 이클립스에서 할수 있는 방법이 없는지 찾아보던중 

https://github.com/behumble/dexdex 을 찾긴 했는데.. 

이 방법으로 해결할수 있는지는 아직 테스트 해보지 않았다.



블로그 이미지

날기억해

Android / IOS / PHP / System Engineer / Service Architecture/ MongoDB / AWS / Mysql / Linux / Python / C++ / Vue.js / node.js / Java / Iot / BLE / Firebase / Bigdata Architecture / AD Server / SDK / Epub /

,

Eclipse Config 설정 및 성능 최적화

''eclipse.ini''

기본 Preferences 최적화

  • 4.2(Juno)일 경우 Preferences → General → Appearance
    • ThemeClassic으로 변경해야 빨라진다.
    • Enabled animations를 끈다.
  • Preferences → General : Show Heap status : 메모리 사용상태와 GC 강제 실행 버튼를 보여줌.
  • Preferences → General → Editors → Text Editors : Show line numbers
  • Preferences → General → Appearance → Colors and Fonts : Basic Text Font나눔고딕코딩 혹은 그 외 코딩용 글꼴로 변경한다. 코딩용 글꼴은 고정폭이고 숫자 1,대문자 아이(I), 소문자엘(l), 숫자 0과 알파벳 오(O)를 구분 할 수 있어야 한다.
  • Preferences → General → Editors → Text Editors에서 배경색 눈 안아픈 회색 톤으로 조정
  • Preferences → General → Workspace에서 Text file encoding과 New text file delimiter의 기본 값을 정해준다.
  • Maven과 연동해서 사용할 경우, Maven 빌드에서 생성한 target 디렉토리의 JSP/HTML 등을 Eclipse가 Validation하느라 상당한 시간을 소모하기도 한다. 이 때는 Preferences → Validation → 각 항목에서 Exclude Gruop을 만들고 target/ 디렉토리를 Rule로 추가한다.
  • Preferences → Team → Ignored Resourcestargetbin 등의 빌드 디렉토리 추가.
  • Windows 환경 성능 최적화
    • 프로젝트 폴더의 속성 → 일반 → 고급 : 이 폴더의 파일 속성 및 내용 색인 허용 체크 해제
    • 백신 프로그램의 실시간 감시에서 프로젝트 폴더를 예외로 설정한다.(파일 락을 거는 현상도 줄어들겠지?)
  • 기타 최적화
    • spell check 해제 : Preferences → General → Editors → Text Editors → Spelling에서 체크 해제.
    • Validation에서 build 쪽은 꼭 필요한 것만 남기고 모두 해제
    • General → Appearance → Label Decorations에서 SVN/CVS 및 기타 등등의 데코레이션 제거.
  • DIFF에서 공백 무시
    • Preferences → General → Compare/Patch에서 Ignore white space 체크
    • Preferences → Java → Editor → Save Actions 에서 저장시 액션들을 지정한다.
    • Remove Trailing whitespace 선택
    • Remove unused imports 선택, …

단축키 추가

  • Copy Fully Qualified Name : Ctrl+Alt+Q
  • Toggle Folding : Ctrl+Shift+= when Editing Text - 87 키보드에는 숫자 키패드가 없어서 기본 단축키 사용 불가.
  • Open Implementation : Ctrl-Shift-F3

Workspace 설정 정보 공유

  • File → Export에서 Preferences를 Export하여 파일로 저장하면 현재 워크스페이스의 설정정보가 저장된다.
  • 이 파일을 다른 워크스페이스에서 Import 하면된다.

기타 설정

WTP + Tomcat

  • WTP에서 Tomcat을 실행할 때 항상 메모리 용량을 지정해주는 것이 좋다. 요즘 특히 Spring Framework를 사용하면서 PermGen 부족을 많이 겪게 된다.
  • Run → Run Configurations → 실행기 선택 → Arguments
    -Xmx512m -XX:PermSize=64m -XX:MaxPermSize=256m
  • 아니면 위 옵션을 Tomcat 실행 JRE의 Default VM arguments로 지정해둔다. Preferences → Java → Installed JREs → 원하는 JRE Edit
블로그 이미지

날기억해

Android / IOS / PHP / System Engineer / Service Architecture/ MongoDB / AWS / Mysql / Linux / Python / C++ / Vue.js / node.js / Java / Iot / BLE / Firebase / Bigdata Architecture / AD Server / SDK / Epub /

,

[android-ndk-r9] 

NDK빌드중에 에러가 발생했다

format not a string literal and no format arguments [-Werror=format-security]


{android_ndk_root}/build/core/default-build-commands.mk에서

"-Werror=format-security" 을 검색해서 삭제해준다.


블로그 이미지

날기억해

Android / IOS / PHP / System Engineer / Service Architecture/ MongoDB / AWS / Mysql / Linux / Python / C++ / Vue.js / node.js / Java / Iot / BLE / Firebase / Bigdata Architecture / AD Server / SDK / Epub /

,

Discrollview

Regularly, I am pleasantly surprised by websites using a pattern I called the discrollver pattern. I'm sure you already know what I'm talking about but if not, http://vimeo.com/player is a good example. When you scroll, widgets appear from nowhere by fade, translation or scale.

With DiscrollView, I wanted to import this pattern on Android. This is an 0.0.1 alpha version because you have to do all the transformation work (fade, translation, scale etc) yourself base on a ratio value. I'm going to add some transformation presets (translation from left to right + fade in for example) to make the library more ready to use for lazy developers.

Animated gif (on youtube)

Try out the sample APK here

Or browse the source code of the sample application for a complete example of use.

Including in your project

Just add the library to your application as a library project.

Usage

Using the library is simple, just look at the source code of the provided sample here

build.gradle

compile 'com.github.flavienlaurent.discrollview:library:0.0.2@aar'

The main layout

You must use the DiscrollViewContent view.

<com.flavienlaurent.discrollview.lib.DiscrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:discrollve="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.flavienlaurent.discrollview.lib.DiscrollViewContent
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <!-- here you put discrollvable views -->

    </com.flavienlaurent.discrollview.lib.DiscrollViewContent>

</com.flavienlaurent.discrollview.lib.DiscrollView>

Discrollvable views

You can apply some transformation on discroll:

  • alpha
  • scale
  • translation (fromLeft, fromBottom, fromRight, fromTop) fromLeft+fromRight and fromBottom+fromTop are forbidden couples.
  • bgcolor
discrollve:discrollve_alpha="true"
discrollve:discrollve_translation="fromLeft|fromBottom"
discrollve:discrollve_scaleX="true"
discrollve:discrollve_scaleY="true"
discrollve:discrollve_fromBgColor="#88EE66"
discrollve:discrollve_toBgColor="#000000"
discrollve:discrollve_threshold="0.3"

The threshold attribute is used to trigger the discrollve at a specified ratio. For example, if threshold=0.3, the discrollve starts when the ratio >= 0.3.

A simple example

<com.flavienlaurent.discrollview.lib.DiscrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:discrollve="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.flavienlaurent.discrollview.lib.DiscrollViewContent
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="600dp"
            android:background="@android:color/white"
            android:textColor="@android:color/black"
            android:padding="25dp"
            android:textSize="72sp"
            android:gravity="center"
            android:fontFamily="serif"
            android:text="Do you love cheese?" />

        <View
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:background="#007788"
            discrollve:discrollve_alpha="true"
            discrollve:discrollve_threshold="0.3" />

        <ImageView
            android:layout_width="200dp"
            android:layout_height="120dp"
            discrollve:discrollve_alpha="true"
            discrollve:discrollve_translation="fromLeft|fromBottom"
            android:src="@drawable/cheese1" />

        <View
            android:layout_width="match_parent"
            android:layout_height="200dp"
            discrollve:discrollve_fromColor="#88EE66"
            discrollve:discrollve_toColor="#000000" />

        <ImageView
            android:layout_width="220dp"
            android:layout_height="110dp"
            android:layout_gravity="right"
            android:src="@drawable/cheese2"
            discrollve:discrollve_translation="fromRight" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="20dp"
            android:fontFamily="serif"
            android:gravity="center"
            android:text="When the cheese comes out everybody's happy pecorino red leicester"
            android:textSize="18sp"
            discrollve:discrollve_alpha="true"
            discrollve:discrollve_translation="fromBottom" />

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="20dp"
            android:layout_gravity="center"
            android:src="@drawable/ilovecheese_heart"
            discrollve:discrollve_scaleX="true"
            discrollve:discrollve_scaleY="true"  />

    </com.flavienlaurent.discrollview.lib.DiscrollViewContent>
</com.flavienlaurent.discrollview.lib.DiscrollView>

License

Copyright 2013 Flavien Laurent

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


블로그 이미지

날기억해

Android / IOS / PHP / System Engineer / Service Architecture/ MongoDB / AWS / Mysql / Linux / Python / C++ / Vue.js / node.js / Java / Iot / BLE / Firebase / Bigdata Architecture / AD Server / SDK / Epub /

,

프로젝트 폴더에 있는 project.properties파일을 열어서

원인은 정확하게 모르겠지만.. 문제점은 android.library.reference.1=의 경로를 제대로 인식 못하게 적용 된것 같다.

../facebook -> ..\facebook 이런식으로 file separator를 윈도우 형식에 맞게 변경해주면 된다.

블로그 이미지

날기억해

Android / IOS / PHP / System Engineer / Service Architecture/ MongoDB / AWS / Mysql / Linux / Python / C++ / Vue.js / node.js / Java / Iot / BLE / Firebase / Bigdata Architecture / AD Server / SDK / Epub /

,

ParallaxHeaderViewPager

IT/Android 2014. 5. 28. 02:16


Android-ParallaxHeaderViewPager

This library is pager UI for Android.
(such as pager UI in Play NewsStand Application)

screens

I made this based on very good libraries such as below.

  1. NotBoringActionBar (https://github.com/flavienlaurent/NotBoringActionBar
  2. PagerSlidingTabStrip (https://github.com/astuetz/PagerSlidingTabStrip

How to implement? see below.
1. Change ListView in NotBoringActionBar to ViewPager.
2. Make ListView or ScrollView of Fragment in ViewPager.
3. Make Interface that Activity can get a Listener when you use OnScroll() in ListView or ScrollView.
4. Make Interface which is available to scroll when some events is happened in ListView or ScrollView.

From now on, you can fix scrollY value in ListView wherever the pages are swiped through the interface you've just made.

Video

http://www.youtube.com/watch?v=sCP-b0a1x5Y

Developed By

License

Copyright 2014 Kim Min Soo

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


[출처] https://github.com/kmshack/Android-ParallaxHeaderViewPager

'IT > Android' 카테고리의 다른 글

[Android] Discrollview Sample  (0) 2014.07.02
이클립스에서 Android Library 빨간엑스가 발생할때  (0) 2014.05.30
[SqlLite] 성능향상방법 2  (0) 2014.05.22
[SqlLite] 성능향상방법 1  (0) 2014.05.22
Folding Animation  (0) 2014.05.19
블로그 이미지

날기억해

Android / IOS / PHP / System Engineer / Service Architecture/ MongoDB / AWS / Mysql / Linux / Python / C++ / Vue.js / node.js / Java / Iot / BLE / Firebase / Bigdata Architecture / AD Server / SDK / Epub /

,

[출처] http://regularmotion.kr/android-sqlite-bulk-insert/

[ANDROID] SQLITE BULK INSERT.

1000개 이상의 Row를 Database에 Insert하는 기능을 구현하게 됐다.

Loop를 돌며 하나씩 Insert하는 방식으로 구현을 하니 단말기에 따라 15~30초 정도가 소요된다.

코딩호러가 주장하듯 성능은 곧 기능이다. 다행히도 아래 2가지 방법을 통해 쉽게 성능을 개선 할 수 있다.

(* 첫번째 방법의 경우 Transaction으로 처리해줘야 성능향상이 있다.)

 

1.  SQLiteStatement

 

2. INSERT UNION

 

1000개의 Row를 Insert하는 예제를 10번씩 테스트한 결과는 아래와 같다.

(* Union을 이용한 방법이 성능면에서는 월등한 것을 확인할 수 있다.)

SQLiteStatement : 138ms

Insert Union : 75ms

 

 

Conclusion

1.  SQLiteStatement

Interface가 직관적이고 제약사항이 없어서 간결하게 코드를 구현할 수 있는 장점이 있지만, 속도가 다소 느린 단점이 있다.

 

2. Insert Union

속도가 빠르다는 장점이 있지만, Query를 생성하는 코드의 가독성이 떨어지고, 한번에 처리할 수 있는 최대 Row가 SQLite의 경우 500개로 제한되어 있어 500개씩 나눠서 처리해야하는 단점이 있다.

 

약간의 성능 저하도 포기할 수 기능을 구현중이라면 Union을 사용하는게 바람직하고, 코드의 가독성 및 유지 보수가 더 중요하다면 SQLiteStatement를 사용하는게 바람직하다.

 

(혹시, 더 빠른 방법이 있으면 댓글로 좀 알려주시기 바랍니다.)


블로그 이미지

날기억해

Android / IOS / PHP / System Engineer / Service Architecture/ MongoDB / AWS / Mysql / Linux / Python / C++ / Vue.js / node.js / Java / Iot / BLE / Firebase / Bigdata Architecture / AD Server / SDK / Epub /

,