Giter Site home page Giter Site logo

Comments (12)

cp949 avatar cp949 commented on August 24, 2024 3

My test results

## build.gradle file
compile 'com.jakewharton.threetenabp:threetenabp:1.0.3'

FIRST TEST

#  proguard file for Threeten backport
-dontwarn java.util.spi.LocaleServiceProvider
-dontwarn sun.util.calendar.*
-keep class org.threeten.bp.zone.*
-keep class org.threeten.bp.*

android test code:
    Log.e(LOG_TAG, "toJson:" + new Gson().toJson(LocalDateTime.now()));

console output :
    toJson:{"a":{"a":2015,"b":11,"c":14},"b":{"b":18,"c":47,"d":37,"e":79000000}}

SECOND TEST

# proguard file for Threeten backport
-dontwarn java.util.spi.LocaleServiceProvider
-dontwarn sun.util.calendar.*
-keep class org.threeten.bp.zone.*
-keep class org.threeten.bp.*
-keepclassmembers class org.threeten.bp.** { *; }


android test code:
    Log.e(LOG_TAG, "toJson:" + new Gson().toJson(LocalDateTime.now()));

console output :
    toJson:{"date":{"day":14,"month":11,"year":2015},"time":{"hour":18,"minute":51,"nano":394000000,"second":14}}

I think you should add the following line in proguard file.
-keepclassmembers class org.threeten.bp.** { *; }

from threetenabp.

JakeWharton avatar JakeWharton commented on August 24, 2024 1
-keep class org.threeten.bp.zone.*

@bryanstern Why did you add this?

from threetenabp.

JakeWharton avatar JakeWharton commented on August 24, 2024 1

I got this far: https://github.com/JakeWharton/ThreeTenABP/compare/jw/PROGUARD_IS_PAIN

Proguard is pain.

from threetenabp.

bryanstern avatar bryanstern commented on August 24, 2024
# Threeten backport
-dontwarn java.util.spi.LocaleServiceProvider
-dontwarn sun.util.calendar.*
-keep class org.threeten.bp.zone.*

I haven't had a chance to exercise these a ton, but they have me building. Found here ThreeTen/threetenbp#12 (comment)

from threetenabp.

JakeWharton avatar JakeWharton commented on August 24, 2024

Bundled rules can be done with:

  buildTypes {
    release {
      minifyEnabled true
      proguardFiles 'proguard.cfg'
      consumerProguardFiles 'proguard.cfg'
    }
  }

from threetenabp.

bryanstern avatar bryanstern commented on August 24, 2024

Good catch, I don't think -keep class org.threeten.bp.zone.* is needed. I misinterpreted some of the build errors that were spit out. I'm not having any issues without it.

from threetenabp.

bryanstern avatar bryanstern commented on August 24, 2024

I'll kick the tires tomorrow on that code, but it looks good. 👍

from threetenabp.

JakeWharton avatar JakeWharton commented on August 24, 2024

I removed it. I also removed -dontwarn java.util.spi.LocaleServiceProvider which isn't used anywhere in 310BP.

from threetenabp.

JakeWharton avatar JakeWharton commented on August 24, 2024

Released in 1.0.2.

from threetenabp.

JakeWharton avatar JakeWharton commented on August 24, 2024

That effectively disables proguard for the whole library. If you don't want
it obfuscated, turn off obfuscation on it in your own config.

On Sat, Nov 14, 2015, 4:57 AM cp949 [email protected] wrote:

build.gradle file

compile 'com.jakewharton.threetenabp:threetenabp:1.0.3'

FIRST TEST

proguard file for Threeten backport

-dontwarn java.util.spi.LocaleServiceProvider
-dontwarn sun.util.calendar.*
-keep class org.threeten.bp.zone.*
-keep class org.threeten.bp.*

android test code:
Log.e(LOG_TAG, "toJson:" + new Gson().toJson(LocalDateTime.now()));

console output :
toJson:{"a":{"a":2015,"b":11,"c":14},"b":{"b":18,"c":47,"d":37,"e":79000000}}

SECOND TEST

proguard file for Threeten backport

-dontwarn java.util.spi.LocaleServiceProvider
-dontwarn sun.util.calendar.*
-keep class org.threeten.bp.zone.*
-keep class org.threeten.bp.*
-keepclassmembers class org.threeten.bp.** { *; }

android test code:
Log.e(LOG_TAG, "toJson:" + new Gson().toJson(LocalDateTime.now()));

console output :
toJson:{"date":{"day":14,"month":11,"year":2015},"time":{"hour":18,"minute":51,"nano":394000000,"second":14}}

I think you should add the following line in proguard file.
-keepclassmembers class org.threeten.bp.** { *; }


Reply to this email directly or view it on GitHub
#4 (comment)
.

from threetenabp.

cp949 avatar cp949 commented on August 24, 2024

My server uses the java8 and LocalDateTime.
The json messages received from the server can not handle because threeten-Proguard on Android.

I probably always will be off the threeten-proguard.

from threetenabp.

JakeWharton avatar JakeWharton commented on August 24, 2024

If you are JSON serializing the objects then that is something specific to
your application and should be addressed in your proguard config. The
library does not concern itself with retaining field names by default
because most people will not be doing this.

On Sat, Nov 14, 2015, 3:52 PM cp949 [email protected] wrote:

My server uses the java8 and LocalDateTime.
The json messages received from the server can not handle because
threeten-Proguard on Android.

I probably always will be off the threeten-proguard.


Reply to this email directly or view it on GitHub
#4 (comment)
.

from threetenabp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.