在设置我的构建服务器以使用Firebase测试实验室进行espresso测试时,我一直遇到错误。
ERROR: (gcloud.beta.test.android.run) Permission denied while fetching the default results bucket
(Error 403: Access Not Configured. Cloud Tool Results API has not been used in project CLOUD_PROJECT_ID before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/toolresults/overview?project=CLOUD_PROJECT_ID then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.).
Is billing enabled for project: [PROJECT_ID]?
当我在自己的机器上尝试使用我自己的帐户登录时,运行以下命令可以正常工作。
gcloud beta test android run \
--type instrumentation \
--app app-debug.apk \
--test app-debug-androidTest.apk \
--device-ids Nexus4,Nexus5 \
--os-version-ids 18,21,25 \
--locales en \
--orientations portrait
在我的构建服务器上,我想使用服务帐户,但是当我执行命令时,我得到前面提到的错误。有谁知道设置它的正确方法是什么?服务帐户是否需要project editor
旁边的某个特殊角色?
在构建脚本中,我执行以下命令,在上传APK的
之前进行身份验证和设置项目gcloud config set project PROJECT_ID
gcloud auth activate-service-account service-account@email.address --key-file ~/gcloud-service-key.json
答案 0 :(得分:6)
终于明白了。如果您要使用Firebase测试实验室的服务帐户,则必须启用Cloud Tool Results API
,而void RS485Init(USART_TypeDef *Usart, uint32_t BaudRate, uint16_t DataBits, uint16_t Parity, uint16_t StopBits){
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
NVIC_InitTypeDef NVIC_InitStruct;
// Enable clock for GPIOD
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_USART3);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_USART3);
// Initialize pins as alternating function
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_Init(GPIOD, &GPIO_InitStructure);
USART_InitStructure.USART_BaudRate = BaudRate;
USART_InitStructure.USART_WordLength = DataBits;
USART_InitStructure.USART_StopBits = StopBits;
USART_InitStructure.USART_Parity = Parity;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(USART3, &USART_InitStructure); // USART3-> Usart
NVIC_InitStruct.NVIC_IRQChannel = USART3_IRQn;
NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStruct);
USART_Cmd(Usart,ENABLE);
}
只能通过Google Cloud Console启用,而不能通过Firebase控制台启用。
答案 1 :(得分:2)
此外,您可能正在使用CI / CD服务器并使用服务帐户进行身份验证...不要像我一样,不要使用Google云平台服务帐户。相反,从此处使用Firebase服务帐户 json密钥
https://console.firebase.google.com/u/0/project/YOUR_PROJECT_ID/settings/serviceaccounts/