androidweb3-java

how to fix 'no such algorithm ecdsa for provider bc' while creating new wallet file using web3j


I am doing this on the latest version of the android studio and minimum SDK version is 15 dependencies:

> implementation fileTree(dir: 'libs', include: ['*.jar'])
> implementation 'com.android.support:appcompat-v7:28.0.0'
> implementation 'com.android.support.constraint:constraintlayout:1.1.3'
> testImplementation 'junit:junit:4.12' androidTestImplementation
> 'com.android.support.test:runner:1.0.2' androidTestImplementation
> 'com.android.support.test.espresso:espresso-core:3.0.2' implementation
> 'org.web3j:core:4.2.0-android' implementation
> 'com.android.support:multidex:1.0.3' implementation
> 'com.squareup.okhttp3:okhttp:3.14.0' implementation
> "io.reactivex.rxjava2:rxjava:2.2.2"

My code is:

public String createWallet() throws Exception {
        String path = Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS).getPath().toString();
        String fileName = WalletUtils.generateNewWalletFile("password", new File(path));
        return path + fileName;
}

Solution

  • you can check here!

    @serso gives a function "setupBouncyCastle()" that you have to put in your class and call it in onCreat. this replace the Android version of Bouncy Castle with the shipped one! like he said. ^^