0

我想javax.money.CurrencyUnit通过使用创建:

   public static CurrencyUnit getCurrency() {
    return Monetary.getCurrency("IDR");
   }

但是,我得到了错误:

    java.lang.NoClassDefFoundError:  
  at javax.money.RoundingContextBuilder.<init> (RoundingContextBuilder.java:32) 
  at javax.money.RoundingContextBuilder.of (RoundingContextBuilder.java:77) 
  at javax.money.DefaultMonetaryRoundingsSingletonSpi$DefaultCurrencyRounding.<clinit> (DefaultMonetaryRoundingsSingletonSpi.java:266) 
  at javax.money.DefaultMonetaryRoundingsSingletonSpi.<clinit> (DefaultMonetaryRoundingsSingletonSpi.java:43) 
  at javax.money.Monetary.loadMonetaryRoundingsSingletonSpi (Monetary.java:125) 
  at javax.money.Monetary.<clinit> (Monetary.java:54) 
  at id.co.bippo.bidapplication.util.Utils.getCurrency (Utils.java:912)

在具有规范的android中: Asus ZenFone 5 (ASUS_T00F), 1024MB RAM, Android 4.3

为了gradle钱:

compile 'javax.money:money-api-bp:1.0.1'
compile 'org.javamoney:moneta-bp:1.1'
4

1 回答 1

0

尝试使用这个

compile group: 'javax.money', name: 'money-api', version: '1.0.1'
compile group: 'org.javamoney', name: 'moneta-bp', version: '1.1'
于 2017-10-11T07:53:21.157 回答