Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cordova and crashlytics beta build script

I am trying to write a script file that builds my apk and uploads it to Crashlytics beta without success.

echo "\n > cordova build android\n"
cordova build android --release

echo "\n > signing apk\n"
jarsigner \
  -storepass $STOREPASS \
  -sigalg SHA1withRSA \
  -digestalg SHA1 \
  -keystore $KEYSTORE \
  $APK_PATH \
  $NAME

mkdir -p releases
zipalign -f -v 4 \
  $APK_PATH \
  $TARGET_PATH

the script works perfectly but when I run

java -jar scripts/crashlytics-devtools.jar \
  -projectPath $PROJECT_PATH \
  -androidManifest $PROJECT_PATH/AndroidManifest.xml \
  -androidRes $PROJECT_PATH/res \
  -androidAssets $PROJECT_PATH/assets \
  -apiKey $FABRIC_API_KEY \
  -apiSecret $FABRIC_BUILD_SECRET \
  -uploadDist $APK \
  -verbose

it gives me a Exception in thread "main" com.crashlytics.tools.android.DeveloperTools$PluginException: Crashlytics halted compilation because it can't extract Crashlytics build info from the APK

Any help?

like image 715
kilianc Avatar asked Nov 10 '22 19:11

kilianc


1 Answers

I got this working by…

  1. Installing fabric into platforms/android/build.gradle
  2. Installing the Fabric plugin

    https://github.com/engincancan/cordova-fabric-io-plugin

To install Fabric into the build.gradle I did the following…

  1. Install Android Studio.
  2. Install the Fabric plugin for Android Studio.
  3. Open the project in platforms/android in Android Studio.
  4. Click on the Fabric button in the toolbar, sign in and go through the installation wizard.

The wizard tells you what it is adding to the project so, if you are really motivated, you could write your own script to do the same thing. This would mean that you could build from the command line without checking in platforms/android.

Afterwards the script you provided works fine.

like image 132
Onato Avatar answered Nov 14 '22 23:11

Onato