App not found when migrating to appcenter from hockeyapp - android

I have an app that I build on CI using fastlane and I publish on HockeyApp.
I'm already accessing the build on AppCenter and everything is fine.
Now, I want to replace the call to the hockey plugin in the fastfile with a call to appcenter_upload.
The appcenter_upload asks me to define owner_name and app_name.
What I have seen is that these values are then used to build a URI:
https://appcenter.ms/orgs/{owner_name}/apps/{app_name}
When I open the app in AppCenter I can read that parts of the URI.
https://appcenter.ms/orgs/mobile-XXXX/apps/MyApp-Name
I tried to use
owner_name=mobile-XXXX
app_name=MyApp-Name
This was the code with hockey-app
hockey(
api_token: HOCKEYAPP_TOKEN,
apk: "path/to/apk",
notes: notes,
status: "2",
notes_type: "1",
teams: team,
commit_sha: `git rev-parse HEAD`.strip,
strategy: "add"
)
This is the code with appcenter_upload
ENV["APPCENTER_DISTRIBUTE_RELEASE_NOTES_CLIPPING"] = notes
appcenter_upload(
owner_name: "mobile-XXX",
app_name: "MyApp-Name,
api_token: HOCKEYAPP_TOKEN,
apk: "path/to/apk",
group: team
)
I was expecting this to be enough to publish directly in appcenter but the appcenter_plugin tells me that the app can't be found and asks me whether I want to create a new one.
I don't want to create another one.
This is the message I get:
Error 401: {"message"=>"12345678-abcd-ef01-994a-0123456789ab", "statusCode"=>401, "code"=>"Unauthorized"}
App with name MyApp-Name not found, create one? (y/n)

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)"
}
}

How can i specify the app (created in the Google Play Console) i want to update using Fastlane?

I'm currently trying to setup continuous integration with help of "Fastlane".
The Project is ready to be build and uploaded to the Google Play Store. If I do this manually everything works fine.
We want to have three different Apps in Google Play (with three different identifiers [com.myapp, com.myapp.int, com.myapp.rc]). With only one of them being public. The reason behind that is to be able to install every environment on one device for testing purposes. This is of course not the most elegant way of achieving this. But I believe that it's the only one and probably not without reasons.
So I'm able to build the app for different environments. The problem I'm currently facing is that if I want to upload them using Fastlane I'm only able to upload the one with the identifier com.myapp the other ones get the following error message:
[10:57:14]: fastlane finished with errors
[!] Google Api Error: forbidden: APK has the wrong package name. - APK has the wrong package name.
This sounds reasonable as I have never specified which app i want to update. If I manually upload the AAB I navigate to the right app inside the "Google Play Console" and upload it there but it seems that this option is not present in Fastlane (which would be pretty weird).
It is also weird that only one of them works as I wasn't even able to chose which one should work. How is Google/Fastlane choosing which App i want to update?
First i thought that the app would be specified inside the json key for google play. But I read in this medium post that it would be the same one across different projects.
Here is my Fastfile:
default_platform(:android)
platform :android do
desc "Runs all the tests"
lane :test do
gradle(task: "test")
end
desc "Submit a new Beta Build to Play Store"
lane :beta do
sh("cp", "../../.env.integration", "../../.env")
gradle(task: 'clean')
gradle(
task: 'bundle',
build_type: 'Release',
print_command: false,
)
upload_to_play_store(
track: 'internal'
)
end
end
And here is my Appfile:
json_key_file("~/.private_keys/google_api_key.json")
package_name("com.myapp")
for_platform :android do
for_lane :beta do
package_name("com.myapp.int")
end
end
The package_name() function you call in your Appfile will specify which App in Google Play fastlane should try to update.
However it does not determine the applicationId which gradle uses to build the App, so you have to make sure that these two values match.
This is how we solved it:
lane :build_lane do
slack(message: "Starting build for myapp", default_payloads:[])
build_android kFlavour:"myapp1" , kPackage_name:"com.abc.def"
end
With this part:
lane :build_android do | options |
sh("flutter", "build", "appbundle", "--flavor", options[:kFlavour], "--no-sound-null-safety")
slack(message: "Uploading " + options[:kFlavour] + " to playstore", default_payloads:[])
upload_to_play_store(
track: 'internal',
track_promote_to:'alpha',
version_code: flutter_version()["version_code"],
version_name: flutter_version()["version_name"] + '+' + flutter_version()["version_code"],
aab: "../build/app/outputs/bundle/"+options[:kFlavour]+"Release/app-" + options[:kFlavour] + "-release.aab",
skip_upload_changelogs: true,
skip_upload_screenshots: true,
skip_upload_images: true,
package_name: options[:kPackage_name],
)
slack(message: options[:kFlavour] + " successfully released on Android!", default_payloads:[])
end
We added the package_name line in the upload_to_play_store()
According to the documentation, you can specify the path to an APK or AAB through the apk or aab parameter.
In your example you should be able to upload a specific android app bundle like this (replace PATH_TO_AAB.aab with actual relative or absolute path to the file):
upload_to_play_store(
track: 'internal',
aab: 'PATH_TO_AAB.aab'
)
Alternative
Alternatively, you can create three different lanes for the three app versions you have.
In each lane you can then specify which flavor must be build in the gradle task.
For example if one of your flavors / versions has the name "pro", you can set the build_type in the gradle command to ProRelease instead of Release. This way, only the release version of the specific flavor is built.
desc "Submit a new Beta Build to Play Store"
lane :beta do
releaseFilePath = File.join(Dir.pwd, "..", "keystores","my-release-key.keystore")
gradle(task: 'clean')
gradle(
task: 'bundle',
build_type: 'ProRelease',
print_command: false,
)
upload_to_play_store(
track: 'internal'
)
end

Is it possible to use Jenkins for Flutter?

Is it possible to create pipeline for build release to play store using Jenkins with Flutter? I need to build a release for production/dev to play store.
It is possible, the easiest way to do this is to use a tool like Fastlane that integrates with Jenkins. I have used Fastlane myself and it's just incredible the amount of time it can save. It has an amazing CLI that can scaffold a deploy for you.
It has integrations with Jenkins https://docs.fastlane.tools/best-practices/continuous-integration/jenkins/
Example Fastfile file:
private_lane :push_test_flight do
sync_code_signing # Handles certificates
increment_build_number(
build_number: "1.2.5"
)
increment_version_number(
version_number: "1.0.0"
)
build_app(workspace: ENV["WORKSPACE"], scheme: "Example App")
upload_to_testflight(
reject_build_waiting_for_review: true,
demo_account_required: true,
beta_app_feedback_email: "some#mail-o.co",
beta_app_description: "A proof of concept app",
notify_external_testers: false,
changelog: "POC Updates",
beta_app_review_info: {
contact_email: "some#mail-o.co",
contact_first_name: "Some",
contact_last_name: "Mail",
contact_phone: "5558675309",
demo_account_name: "demo#mail.com",
demo_account_password: "demo#mail",
notes: "A proof of concept app"
},
)
end
This will manage my iOS distribution certificates, build the app with XCode and then push to testFlight!

How to set release name when using fastlane upload_to_play_store?

In play console when you create a release it is possible to provide a release name. But when using upload_to_play_store command in fastlane i cannot see a parameter to provide a custom release name when pushing the apk, but takes the version name as the release name. How is it possible to achieve it?
lane :beta do
gradle(
task: 'assemble',
build_type: 'Release'
)
upload_to_play_store(track:'beta')
end
While Aaron Brager's answer was correct at the time this was asked, the version_name parameter has been added to the upload_to_play_store (aka supply) action since version 2.136.0 of fastlane.
Following the naming convention of releases in the Google Play Console, you could use something like this in your Fastfile for your lane:
version_name: build_number + "(" + version_name + ")", # 1 (0.0.1)
So your lane could be fined like this:
lane :beta do
gradle(
task: 'assemble',
build_type: 'Release'
)
upload_to_play_store(
track: "beta",
version_name: build_number + "(" + version_name + ")", # 1 (0.0.1)
)
end
More info
There was an issue raised on this topic on fastlane's GitHub repo that discussed the details of this and confirmed its implementation: How to set release name when using upload_to_play_store?
This is the original blog post on the Android Developers Blog: Automating your app releases with Google Play
fastlane release 2.136.0 (I have not found a reference specifically to this change, but I might have missed it. The version has been referred to in this comment on GitHub, in the issue I mentioned above)
fastlane uses Google's AndroidPublisherService to upload APKs. Uploads are done via its upload_apk instance method. This method does not appear to take an argument for the release name, so fastlane does not expose one.
If you can figure out how to set the release name using AndroidPublisherService, you can pass a parameter through to the service via fastlane here.

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.

Categories

Resources