10

I've been trying to generate an .apk (debug or release) and I've been getting this error:

com.android.ide.common.signing.KeytoolException: Failed to read key AndroidDebugKey from store "/home/note-300/.android/debug.keystore": DerInputStream.getLength(): lengthTag=109, too big.

I already tried creating a new key (with key and alias with the same name) on Android Studio, I deleted the .android/debug.keystore and run the following commands (from here):

keytool -importkeystore -srckeystore old.keystore -destkeystore new.keystore -deststoretype pkcs12

and

 keytool -importkeystore -srckeystore new.keystore -srcstoretype pkcs12 -destkeystore final.keystore -deststoretype jks

What else can I do to run my app?

OS: Ubuntu 18.04

Android Studio 3.3.1

2
  • You mention that you created the key using AS then deleted the keystore and recreated it using the command line, is that correct ? why not just create everything using AS tool, it's pretty straightforward?
    – 113408
    Feb 14, 2019 at 20:36
  • @113408 I created the key on AS and got this error. Delete it and created again using command line, got the same error.
    – yasin
    Feb 15, 2019 at 10:49

2 Answers 2

12

Try upgrading gradle from in the gradle-wrapper.properites file from 4.10.1 to 4.10.2. I had the same problem, and that fixed it for me.

3
  • 3
    After trying everything I could find, nothing worked. Then I did two things that finally got me up any running. 1) Regenerated the keystore using this url: coderwall.com/p/r09hoq/android-generate-release-debug-keystores I also used the suggested step to convert the jks to pkcs12, this step was provided when you run the keytool command. 2) Then I created a new React Native app folder by doing react-native init myNewAppName This time when I ran the react-native run-android everything build fine. Apr 7, 2019 at 14:38
  • Thank you so much. It saved me a lot of time and effort. Mar 2, 2020 at 13:02
  • Wow, thanks! There was a Gradle upgrade message in AS and I accepted it and the signing worked again.
    – Lucy
    Jul 21, 2021 at 4:22
12

Probably not the exact answer but the below steps solved my problem. Because I was already using gradle 4.10.2.

Steps:

  1. Delete .gradle folder from android folder.

  2. Run react-native run-android.

The above steps fixed the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.