Initially publishing a github package shows "Username must not be null!" - github

I am trying to publish a package on Github using the Gradle part in Android Studio. It is not my first one but I cannot find what the difference is to the previous ones and why I get this error.
I can successfully run the build step and the files are in the output folder. However, when I run the step "publish", I get the following error:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task
':config_properties_reader_android:publishBarPublicationToGitHubPackagesRepository'.
Failed to publish publication 'bar' to repository 'GitHubPackages'
-> Username must not be null!
The only difference I could find was that my module folder with the files to publish contains three instead of the usual two files:
Those two I would expect:
config_properties_reader_android/build/outputs/aar/config_properties_reader_android-debug.aar
config_properties_reader_android/build/outputs/aar/config_properties_reader_android-release.aar
And this one seems odd:
config_properties_reader_android/build/outputs/aar/configpropertiesreader-debug.aar
My gradle file looks like this:
apply plugin: 'maven-publish'
def githubProperties = new Properties()
githubProperties.load(new FileInputStream(rootProject.file("github.properties")))
def getVersionName = { ->
return "1.0.0"
}
def getArtificatId = { ->
return "config_properties_reader_android"
}
publishing {
publications {
bar(MavenPublication) {g
groupId 'com.MyGithubRepo'
artifactId getArtificatId()
version getVersionName()
artifact("$buildDir/outputs/aar/${getArtificatId()}-release.aar")
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/MyGithubRepo/ConfigPropertiesReader.Android")
credentials {
username = githubProperties['gpr.usr'] ?: System.getenv("GPR_USER")
password = githubProperties['gpr.key'] ?: System.getenv("GPR_API_KEY")
}
}
}
}
And my github.properties file also contains the usual:
gpr.user=myUser
gpr.key=myKey
Could the third file in the ouput folder be the problem? I do not see how the username should have anything to do with it but I have no idea where to look in order to find the error.

Try this in github.properties file
gpr.usr=myUser
gpr.key=myKey

Change gpr.user => gpr.usr
Also, use your git user-id in gpr.usr
and use git personal access token in gpr.key
i also have this issue this change solve mine problem

check the below line and replace the username and password it will work
file name is build.gradle
maven {
url "https://cardinalcommerceprod.jfrog.io/artifactory/android"
credentials {
username 'braintree_team_sdk'
password 'AKCp8jQcoDy2hxSWhDAUQKXLDPDx6NYRkqrgFLRc3qDrayg6rrCbJpsKKyMwaykVL8FWusJpp'
}
}

Related

yaml language server and nvim configuration

I would like to use nvim lsp to validate an OpenAPI file.
Here are the steps I've been following:
I installed yaml-language-server, and made sure it was available in the PATH
I downloaded the OpenAPI schema from here, and stored it in my filesystem.
I modified my existing init.vim to include the following:
lspconfig.yamlls.setup {
on_attach = on_attach,
flags = {
debounce_text_changes = 150,
},
settings = {
yaml = {
schemas = {
{
fileMatch = { ".openapi.yaml" },
url = "file:///[...]/openapi.schema.yaml"
}
},
format = {
enable = true,
singleQuote = false,
bracketSpacing = true
},
validate = true,
completion = true
}
}
}
I wrote a simple OpenAPI spec file, and opened it with nvim.
It seems that my nvim correctly hits the yaml-language-server to validate the yaml syntax, but it does not seem to validate against the schema.
One of the problem I have is that I don't have access to logs of nvim, or the yaml-language-server, to have some insight about what's going on.
it's been a while but I figured I'd give this a shot in case it helps anyone.
First, about your lack of access to the nvim log. You don't explain why that is but if your nvim is running, and it seems that it is, you should be able to get the log running this command:
:lua vim.cmd('e'..vim.lsp.get_log_path())
I think the way you have the settings.yaml.schemas node is not correct.
It might also be a problem that you are using a yaml format. I highly recommend you use json for open api schema validation. If you want to try this, just sub all the yaml for json (s/yaml/json), and replace your local yaml file with the json one.
See the example below if it works for you.
-- configure yamlls ls:
require('lspconfig')['yamlls'].setup {
on_attach = on_attach,
capabilities = capabilities,
settings = {
yaml = {
schemas = {
["https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.yaml"] = "/*"
}
}
}
}
If you really need to load a local file, either one of these formats should work:
["file:///home/$user/openapi.schema.yaml"] = "/*"
["../relative/path/openapi.schema.yaml"] = "/*"

Jenkins Multibranch-Pipeline JobDSL can't specify github url

I'm creating a Multibranch Pipeline job with JobDSL , and I want to specify my github url , but it's not working.
The job which I created it display "https://github.com/jackson/multibranch-Pipeline.git" ,
not https://mycompanygithub.com/jackson/multibranch-Pipeline.git
Any idea how theses other parameters can be added in ?
or other solution
multibranchPipelineJob('Jenkins/Multibranch-Pipeline/GitHub_Basic') {
branchSources {
branchSource {
source {
github {
repositoryUrl('https://mycompanygithub.com')
credentialsId('mycredentialsid')
repoOwner('jackson')
repository('multibranch-Pipeline.git')
configuredByUrl(true)
}
}
}
}
}
Actually your configuration is correct, your are just missing one parameter: apiUri
// The server to connect to.
apiUri(String value)
Without it, it takes the default github.com as the base domain for the repository regardless of what is configured in the repositoryUrl parameter.
Try the following:
multibranchPipelineJob('Jenkins/Multibranch-Pipeline/GitHub_Basic') {
branchSources {
branchSource {
source {
github {
apiUri('https://mycompanygithub.com/api/v3')
repositoryUrl('https://mycompanygithub.com')
credentialsId('mycredentialsid')
repoOwner('jackson')
repository('multibranch-Pipeline.git')
configuredByUrl(true)
}
}
}
}
}
By the way you can see the full documentation of the Job DSL of this plugin at the following URL on your own Jenkins server:
YOUR_JENKINS_URL/plugin/job-dsl/api-viewer/index.html#method/javaposse.jobdsl.dsl.DslFactory.multibranchPipelineJob

IOException in mReferrerClient.getInstallReferrer() with HMS Core version 5.0.1.307

I want to test my own app before going live after integrating with Huawei install Referrer SDK. I followed all the steps found in codelabs and the documentations and when i install the apk on the device , getInstallReferrer method throws IOException. This is my code. What is it that i am doing wrong ?. how can i get installReferrer info for testing purposes ?
Runnable {
referrerClient = newBuilder(context).setTest(true).build()
referrerClient.startConnection(object : InstallReferrerStateListener {
#SuppressLint("SwitchIntDef")
override fun onInstallReferrerSetupFinished(responseCode: Int) {
when (responseCode) {
InstallReferrerClient.InstallReferrerResponse.OK -> {
// Connection established.
try {
val response: ReferrerDetails = referrerClient.installReferrer
val referrerUrl: String = response.installReferrer
val referrerClickTime: Long = response.referrerClickTimestampSeconds
val appInstallTime: Long = response.installBeginTimestampSeconds
}catch (e : IOException){
Log.i("INSTALL_REFERRER","IOException")
}
catch(e: RemoteException){
Log.i("INSTALL_REFERRER","RemoteException")
}
finally {
referrerClient.endConnection()
}
}
InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED -> {
Log.i("INSTALL_REFERRER","NOT AVAILABLE")
}
InstallReferrerClient.InstallReferrerResponse.SERVICE_UNAVAILABLE -> {
Log.i("INSTALL_REFERRER","SERVICE UNAVAILABLE")
}
}
}
override fun onInstallReferrerServiceDisconnected() {
Log.i("INSTALL_REFERRER","ReferrerServiceDisconnected")
}
})
}.run()
Please check whether the AIDL interface is added.
Check the screenshot below:
Obtain Install Referrer Information by AIDL
You can call an AIDL API provided by HUAWEI Ads Kit to obtain install referrer information from HUAWEI devices, without integrating any HUAWEI SDK. The install referrer information obtained from a device in either mode (SDK or AIDL) is the same.
Call Process
The Development Procedure is as follows
Create an AIDL file for the IPPSChannelInfoService API and save the file.
Copy the following content to the AIDL file:
package com.huawei.android.hms.ppskit;
/** Important: Do not change the method sequence in the AIDL file. */
interface IPPSChannelInfoService {
String getChannelInfo();
}
Change Build Action to AndroidInterfaceDescription of AIDL file.
Rebuild project.
Create a class to implement Android-native IServiceConnection.
For more details, see docs.
Also, please kindly refer to the demo.
Update:
The package name needs to be specified because setTest(true)
if (this.isTest){
var2 = "com.huawei.pps.hms.test";
}
The empty check on ReferrerDetails can be added.
if (null != referrerDetails && null != mCallback)

Back4app issue in registering device with ionic 3

I m trying to use back4app for push notification. For this I have installed back4app's ionic sdk (https://www.back4app.com/docs/ionic/parse-ionic-sdk) like this
npm install parse
then in my app.component.ts I imported parse
import Parse from 'parse';
and in platform ready
Parse.serverURL = "https://parseapi.back4app.com/";
Parse.initialize("APP_ID_HERE", "JAVASCRIPT_KEY"); //I have used real keys from back4app dashboard.
let install = new Parse.Installation();
install.save(null, {
success: (install) => {
// Execute any logic that should take place after the object is saved.
// console.clear();
console.error('New object created with objectId: ' + install.id);
},
error: (install, error) => {
// Execute any logic that should take place if the save fails.
// error is a Parse.Error with an error code and message.
//console.clear();
console.error('Failed to create new object, with error code:' + error.message.toString());
}
});
When I do Ionic serve or test it in device, it should register device/installation id to their backend but it gives 400 Bad Request error on https://parseapi.back4app.com/classes/_Installation the error was -
{"code":135,"error":"deviceType must be specified in this operation"}
I m not sure where to mention deviceType as their documentation doesn't seem that good.
Can anybody help me on this??
This is not mentioned in their documentation but I have found it in one of their example.
Replacing -
let install = new Parse.Installation();
with
let install = new Parse.Installation();
install.set("deviceType", platform.platforms().toString());
Solved the issue.
Here is the link to their repository
Parse SDK now supports Promises.
I'd recommend using it instead of passing in callbacks.
You can accomplish that by:
install.save().then(() => {
// success
}, err => {
// error
})

Uploading different jars to Artifactory with gradle

Is it possible to conditionally upload jars to artifactory?
I have tried using the Artifactory plugin but that works fine if the case is just to upload a single jar from a build pipeline.
If I also want to upload a test jar, how would that go?
Can I have some configuration specifying which jar should be uploaded? e.g. test jar or the "normal" jar file
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
artifactory {
clientConfig.setIncludeEnvVars(true)
contextUrl = 'https://localhost:8081/artifactory/'
publish {
repository {
repoKey = 'libs-release-local'
username = "${artifactory_user}"
password = "${artifactory_user_password}"
}
defaults {
publications('mavenJava')
publishArtifacts = true
publishPom = true
publishIvy = true
}
}
resolve {
contextUrl = 'https://localhost:8081/artifactory'
repository {
repoKey = 'libs-release-local'
username = "${artifactory_user"
password = "${artifactory_user_password}"
maven = true
}
}
}
To publish classes from your test SourceSet (src/test/ by default), you first need to define a task to create the testJar:
task testJar(type: Jar) {
classifier = 'tests'
from sourceSets.test.output
}
Then add it to your publications
publications {
mavenJava(MavenPublication) {
from components.java
artifact testJar {
classifier "test"
}
}
}
Since you're already publishing publications('mavenJava') from artifactory, you do not have to make any changes there.