when i wanna create wallet with generateBip39Wallet function my app is crashed
i must create wallet with this function
my app works on android 9 but it crashes on android 7
please tell me a solution or fix it

my code :

    val dirPath = AndroidApplication.context.getFilesDir().getAbsolutePath()
                val file = File(dirPath)
                val seedWords = WalletUtils.generateBip39Wallet("", file).mnemonic

log cat :

   java.lang.NoClassDefFoundError: Failed resolution of: Ljava/time/format/DateTimeFormatter;
        at org.web3j.crypto.WalletUtils.getWalletFileName(
        at org.web3j.crypto.WalletUtils.generateWalletFile(
        at org.web3j.crypto.WalletUtils.generateBip39Wallet(

Hey the reason your android app crashes is because the DateTimeFormatter class was added in api level 26 as shown here i the docs:
Api level 26 was released in Android 8 as shown here:

1 Like

how can i fix it?
in version 4.5.12 this method (generateBip39Wallet ) throws null pointer exception :man_facepalming:

Hi Hamid, to fix it you’ll need to change the API level of your Android project to support that method, you’d need API level 26 as mentioned by @Alexandrou.

@hamid_b could you provide your stack trace

i solve it by web3j android
but i see another bug

add RemoteFunctionCall to web3j for android

when i compile solidity with web3j and add smart contract to my project, it cant find RemoteFunctionCall, i forced add this class to my project manually.


Hey can you share a minimal example of what you are trying to do on GitHub please.