Pipeline script to upload build(apk) to hockeyApp - android

I am using Jenkins to build my android app. i added "Jenkinsfile" in my repo and my current pipeline script looks like this and it is working fine.
node
{
try {
stage("build.clone")
{
checkout scm
}
stage("build.clean")
{
sh "./gradlew clean"
}
stage("build.package")
{
sh "./gradlew assembleDebug"
}
} catch (error) {
throw error
}
}
Now i need to upload my apk to hockeyapp. HockeyApp's Jenkins plugin is installed. And they have made it compatible with pipeline in v 1.2.2
I have googled a lot but found not much help. Kindly guide me or point me to how I can use pipeline script to upload apk to hockeyapp.
Note: I have already created an app on hockey app and I have app token and app id. Also i know curl command is available but i want to use hockeyapp plugin with pipeline

You should be able to get the syntax for just about any Pipeline step via the snippet generator built in to Jenkins.
Doing so in my Jenkins install gives me something like this (horrifying) syntax:
step([$class: 'HockeyappRecorder',
applications: [[downloadAllowed: false, mandatory: false,
notifyTeam: false, releaseNotesMethod: [$class: 'NoReleaseNotes'],
uploadMethod: [$class: 'AppCreation', publicPage: false]]],
debugMode: false, failGracefully: false])

Related

Expo build apk : ExponentToken not generated

I created my first expo app, who can send notification to multiple users. I use the expo-notification package to generate the ExponentToken and handle incoming notification.
Everythings works perfecly when I use the expo go app, but recently I build my app in apk with eas
$ eas build -p android --profile genAPK
//the genAPK profile :
build: {
"genAPK":{
"android": {
"buildType":"apk"
}
}
}
I downloaded the builded apk, but when my real app want to generate the ExponentToken it just not works and return me a empty string... (I know it because my app crash do a alert() if the token is empty)
I don't know if this help, but I dont use the firebase way, I use the expo node sdk and my own database and API to store tokens and send notifications
Is this a common mistake and how can I fix this ?
Or at least can I see the output of my package even if this is a apk ?
Thanks in advance
My notification is also not working when i upgrade to EAS.
And i found this in Expo discord group:
No experienceId or projectId found. If one or the other can't be inferred from the manifest (eg. in bare workflow), you have to pass one in yourself.
at http://192.168.7.186:8081/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:102608:321 in _createSuperInternal
at node_modules/expo-modules-core/build/errors/CodedError.js:10:8 in constructor
at http://192.168.7.186:8081/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:313197:49 in getExpoPushTokenAsync$
There is a problem with ExpoPushToken, and you can see the source of this error from here expo-notifications-repo. The cause of this error in my case is the projectId, because in the expo-notifications-repo they use expo-constant package which have change in the latest SDK. So i need to add projectId to my app.json
"extra":{
"eas":{
"projectId":"(PROJECT_ID-Expo.dev)"
}
}

Jenkins doesn't recognize IONIC as command

I'm currently setting up Jenkins for a IONIC Project of mine.
I've got a Jenkinsfile with the following content:
pipeline {
agent any
stages {
stage ('NPM Setup'){
steps{
bat 'npm install'
}
}
stage('Android Build'){
steps{
bat 'ionic cordova build android --release'
}
}
}
}
Jenkins causes an Error with the following Errormessage:
The "ionic" command is either misspelled or could not be found.
What am i doing wrong here or is there anything i didn't configure for it to run?
The code is stored in a git-repo if this is anything interesting.
Kind regards
Crooky
add ionic cli to your package.json dependencies.
use npx. This command line is bundled with node since version 5.2.0
stage('Android Build'){
steps{
bat 'npx ionic cordova build android --release'
}
}

Jenkins Android building pipeline from different Git repositories

Hi, I would like to create a job in Jenkins where I would like to build one apk from 2 Android repositories.
I tried it with both Jenkinsfile and Gradle wrapper in the Jenkins GUI, but both are giving the same error at the same point, at the verification Gradle commands.
Since the code in the first repository is depending on the code from the 2nd, the structure was designed that they have to be sibling directories to reach each other.
What went wrong:
Could not determine the dependencies of task ':app:testStaging_gakUnitTest'.
Could not resolve all task dependencies for configuration ':app:staging_gakUnitTestRuntimeClasspath'.
Could not resolve project :ticketingcommons.
Required by:
project :app
Unable to find a matching variant of project :ticketingcommons:
First one is a specific application code repository.
Second one contains the commons for the specific apps to run tests, validation etc...
In the configuration I only set the source-code management and building process fields so far.
I have been trying with pipelines, freestyle projects, multibranch pipelines and nothing seemed to be working.
In the Jenkinsfile, I have the following code, which is supposed to do the same I was doing from the Jenkins GUI:
pipeline {
agent {
// Run on a build agent where we have the Android SDK installed
label 'master'
}
options {
// Stop the build early in case of compile or test failures
skipStagesAfterUnstable()
}
stages {
stage('Compile') {
steps {
// Compile the app and its dependencies
sh 'chmod +x gradlew'
sh './gradlew compileDebugSources'
}
}
stage('Unit test') {
steps {
// Compile and run the unit tests for the app and its dependencies
sh './gradlew test'
// Analyse the test results and update the build result as appropriate
junit 'app/build/test-results/**/*.xml'
}
}
stage('Build APK') {
steps {
// Finish building and packaging the APK
sh './gradlew assembleDev'
// Archive the APKs so that they can be downloaded from Jenkins
archiveArtifacts '**/*.apk'
}
}
stage('Stage Archive') {
steps {
//tell Jenkins to archive the apks
archiveArtifacts artifacts: 'app/build/outputs/apk/*.apk', fingerprint: true
}
}
stage('Static analysis') {
steps {
// Run Lint and analyse the results
sh './gradlew lintDebug'
androidLint pattern: '**/lint-results-*.xml'
}
}
}
post {
failure {
// Notify developer team of the failure
mail to: 'mymail#whynotworking.com', subject: 'Oops!', body: "Build ${env.BUILD_NUMBER} failed; ${env.BUILD_URL}"
}
}
}
I don't know how to make Jenkins have them as sibling directories after cloning them, so the app can see the commons and run the commands. Now it is failing at the tests, but every validation Gradle command makes it fail.
A simple solution could be to create two jobs and customize their workspace directory (So you can use the same directory for both jobs). In your first job just load the repository from git and in the second load the repository and run whatever commands you want.

include.gradle file being generated is causing problems

When building a project I get the following error:
Flavor 'nativescript-telerik-ui' has unknown dimension 'nativescript-telerik-ui'.
It happens only when using the pro version through the #progress registry. Doesn't happen with the local .tgz pro version.
I noticed the error has to do with the include.gradle file it generates. I read the following article: https://docs.nativescript.org/plugins/plugins#includegradle-specification
It says that when the plugin doesn't have the include.gradle, at build time gradle creates a default one with default elements. When I saw the include.gradle it generated for the plugin it seems to have generated a default one like so:
android {
productFlavors {
"nativescript-telerik-ui" {
dimension "nativescript-telerik-ui"
}
}
}
The include.gradle generated for the local .tgz version of the plugin is like this:
android {
productFlavors {
"F6" {
dimension "nativescripttelerikuipro"
}
}
}
I replaced the default include.gradle with the latter and it got past the error. You can recreate the problem by following these steps:
create a new hello world app
use the command npm login --registry=https://registry.npm.telerik.com/ --scope=#progress to log in if you're a paying customer.
use the command npm install --save #progress/nativescript-telerik-ui-pro to install the plugin
use tns run android
Is there anything I can do to solve this problem? Really need help on this.
My name is Vladimir and I am part of the nativescript-telerik-ui-pro team. Thank you for logging this issue in our feedback portal. We are going to review it as soon as possible and update you regarding its status, but from what I currently see there is some incorrect "parameters" passed to the 'pro' version of the plugin that are going to be resolved very fast.
We apologize for any inconvenience that this is causing.

Requiring unknown module "react-native-safari-view" in Release mode

I have a React Native project and it runs successfully on both simulators and devices for iOS.
However, for Android, it runs successfully on simulators without any problems, but when run on devices as a Release build, it gives me this error:
Requiring unknown module "react-native-safari-view".
I tried npm cache clean and npm install several times, but it does not work.
The module exists in node_modules folder and it is also under dependencies in package.json.
What could be the cause of this? Why does it happen only in Release builds?
Update: If this is difficult to fix, is it possible to generate a signed apk with the js bundle included in dev mode?
It is because react-native-safari-view module is not designed for Android.
Check this out: (inside index.android.js file in GitHub)
var SafariViewManager = {
test: function() {
warning('Not yet implemented for Android.');
},
isAvailable: function() {
...
}
};
Maybe you are initiating a SafariViewManager object and calling other functions like show() in index.ios.js without checking it isAvailable()?

Categories

Resources