U1

 1 如果 activity_main.xml没有xml代码可以对图像右键 go to mxl同时可以在design  和  text  切换  

 

在安装了Android Studio3.3版本之后,第一个HelloWorld竟然都报错了(Invalid escape sequence at line 1 column 29 path $[0].name)总之很无奈,后来经过不懈探索终于发现了解决问题的方法,把build.gradle里面的参数3.3.1降为3.2.1即可完美运行。

 

Session 'app':Error Installing APK

因为你没有在手机上确认调试

 

No target device found. (moments ago) 

1.打开Profiler 双击shift键
2.手机上确认
等一会就可以了

 

转载于:https://www.cnblogs.com/tingtin/p/10647380.html

#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include “aip_common.h” #include <string.h> #include <stdlib.h> #define ZERO (0) #define MAX_LINE_LENGTH (256) #define ADD_VALUE (0xF) #define FALSE (0) #define WRONG (0) #define SUCCESS (1) #define TRUE (1) #define STORESIZE (9) #define ENDOFSTRING (8) #define FOUR (4) #define ONE (1) #define SIXTEEN (16) /===================================================================================================================================/ /* Function Name: vd_s_initialize_array */ /* --------------------------------------------------------------------------------------------------------------------------------- */ /* Description: Initializes all elements of an array to ZERO. */ /* Arguments: U1* u1p_a_initialize_array : Pointer to the array to initialize / / size_t stp_a_initialize_size : Size of the array */ /* Return: None */ /===================================================================================================================================/ static void vd_s_initialize_array(U1* u1p_a_initialize_array, size_t stp_a_initialize_size) { size_t stp_t_initialize_array_i; for (stp_t_initialize_array_i = (U4)ZERO; stp_t_initialize_array_i < stp_a_initialize_size; stp_t_initialize_array_i++) { u1p_a_initialize_array[stp_t_initialize_array_i] = (U1)ZERO; /* Initialize each element to ZERO */ } } /===================================================================================================================================/ /* Function Name: vd_s_remove_trailing_newline */ /* --------------------------------------------------------------------------------------------------------------------------------- */ /* Description: Removes trailing newline character (\n) if present in buffer */ /* Arguments: U1* u1p_a_remove_buffer : Pointer to input buffer / / U4 u4_a_remove_length : Length of buffer */ /* Return: None */ /===================================================================================================================================/ static void vd_s_remove_trailing_newline(U1* u1p_a_remove_buffer, U4 u4_a_remove_length) { if ((u4_a_remove_length > (U4)ZERO) && (‘\n’ == u1p_a_remove_buffer[u4_a_remove_length - (U4)ONE])) { u1p_a_remove_buffer[u4_a_remove_length - (U4)ONE] = ‘\0’; /* Replace newline with null terminator */ } } /===================================================================================================================================/ /* Function Name: stp_s_open_input_file */ /* --------------------------------------------------------------------------------------------------------------------------------- */ /* Description: Opens input file “DA_510B_IMG_1.mhx” in binary read mode */ /* Arguments: None */ /* Return: FILE* : File pointer or NULL on failure */ /===================================================================================================================================/ static FILE* stp_s_open_input_file(void) { FILE* stp_t_open_fp; stp_t_open_fp = fopen(“DA_510B_IMG_1.mhx”, “rb”); return stp_t_open_fp; } /===================================================================================================================================/ /* Function Name: stp_s_create_output_file */ /* --------------------------------------------------------------------------------------------------------------------------------- */ /* Description: Creates/opens output file “WRITE_ADDRESS.TXT” in write mode */ /* Arguments: None */ /* Return: FILE* : File pointer or NULL on failure */ /===================================================================================================================================/ static FILE* stp_s_create_output_file(void) { FILE* stp_t_create_output_fp; stp_t_create_output_fp = fopen(“WRITE_ADDRESS.TXT”, “w”); return stp_t_create_output_fp; } /===================================================================================================================================/ /* Function Name: u4_s_process_s315_line */ /* --------------------------------------------------------------------------------------------------------------------------------- */ /* Description: Processes line starting with specified prefix. Extracts hex address, / / adds fixed offset, and stores modified address. */ /* Arguments: U1* u1p_a_process_line : Pointer to input line / / U1* u1p_a_process_new_hex_addr : Output buffer for modified address / / U1* u1p_a_search_str : Prefix string to search */ /* Return: U4 : TRUE if successful, FALSE otherwise */ /===================================================================================================================================/ static U4 u4_s_process_s315_line(U1* u1p_a_process_line, U1* u1p_a_process_new_hex_addr, U1* u1p_a_search_str) { U4 u4_t_process_result; U1* u1p_t_process_search_pos; U1* u1p_t_process_addr_start; size_t stp_t_len_after; U1 u1_tp_store_string[(U4)STORESIZE]; U4 u4_t_address_value; U4 u4_t_new_address; size_t stp_t_search_str_len; u4_t_process_result = (U4)FALSE; stp_t_search_str_len = strlen(u1p_a_search_str); /* Check for exact prefix match at start of line / if (0 == strncmp(u1p_a_process_line, u1p_a_search_str, stp_t_search_str_len)) { u1p_t_process_search_pos = u1p_a_process_line; u1p_t_process_addr_start = u1p_t_process_search_pos + stp_t_search_str_len; / Skip prefix / stp_t_len_after = strlen(u1p_t_process_addr_start); / Verify sufficient length for address extraction / if (stp_t_len_after >= (U4)ENDOFSTRING) { vd_s_initialize_array(u1_tp_store_string, STORESIZE); strncpy(u1_tp_store_string, u1p_t_process_addr_start, (U4)ENDOFSTRING); u1_tp_store_string[(U4)ENDOFSTRING] = ‘\0’; u4_t_address_value = strtoul(u1_tp_store_string, NULL, (U4)SIXTEEN); u4_t_new_address = u4_t_address_value + (U4)ADD_VALUE; / Apply offset */ snprintf(u1p_a_process_new_hex_addr, (U4)STORESIZE, “%08lX”, u4_t_new_address); u4_t_process_result = (U4)TRUE; } } return u4_t_process_result; } /===================================================================================================================================/ /* Function Name: vd_s_address_pair */ /* --------------------------------------------------------------------------------------------------------------------------------- */ /* Description: Writes modified address pair and default settings to output file */ /* Arguments: FILE* stp_a_write_address_fp : Output file pointer / / U1* u1p_a_write_address_hex_addr : Modified hexadecimal address */ /* Return: None */ /===================================================================================================================================/ static void vd_s_address_pair(FILE* stp_a_write_address_fp, const U1* u1p_a_write_address_hex_addr) { if (NULL != stp_a_write_address_fp) { fprintf(stp_a_write_address_fp, “0x40000000,0x%s\n”, u1p_a_write_address_hex_addr); fprintf(stp_a_write_address_fp, “0x43FFFFF0,0x43FFFFFF\n”); /* Write default settings */ } } /===================================================================================================================================/ /* Function Name: vd_s_write_default_address */ /* --------------------------------------------------------------------------------------------------------------------------------- */ /* Description: Writes predefined default address mappings to output file */ /* Arguments: FILE* stp_a_write_default_fp : Output file pointer */ /* Return: None */ /===================================================================================================================================/ static void vd_s_write_default_address(FILE* stp_a_write_default_fp) { if (NULL != stp_a_write_default_fp) { fprintf(stp_a_write_default_fp, “0x40000000,0x00000000\n”); fprintf(stp_a_write_default_fp, “0x43FFFFF0,0x43FFFFFF\n”); } } /===================================================================================================================================/ /* Function Name: u4_s_main_processing_task */ /* --------------------------------------------------------------------------------------------------------------------------------- */ /* Description: Processes input file: searches for prefix, extracts/modifies addresses, writes results */ /* Arguments: U1* u1p_a_search_string : Prefix string to search */ /* Return: U4 : SUCCESS if found and processed, WRONG otherwise */ /===================================================================================================================================/ static U4 u4_s_main_processing_task(U1* u1p_a_search_string) { U4 u4_t_main_processing_result; FILE* stp_t_input_fp; FILE* stp_t_output_fp; U1 u1_tp_line_buffer[(U4)MAX_LINE_LENGTH]; U4 u4_t_target_found; U1 u1_tp_new_hex_addr[(U4)STORESIZE]; size_t stp_t_main_processing_len; U4 u4_t_main_processing_line; U1* u1p_t_main_fgetsresult; u4_t_main_processing_result = (U4)WRONG; stp_t_input_fp = stp_s_open_input_file(); if (NULL != stp_t_input_fp) { stp_t_output_fp = stp_s_create_output_file(); if (NULL != stp_t_output_fp) { u4_t_target_found = (U4)FALSE; vd_s_initialize_array(u1_tp_new_hex_addr, STORESIZE); u1p_t_main_fgetsresult = fgets(u1_tp_line_buffer, (U4)MAX_LINE_LENGTH, stp_t_input_fp); while (NULL != u1p_t_main_fgetsresult) { u1p_t_main_fgetsresult = fgets(u1_tp_line_buffer, (U4)MAX_LINE_LENGTH, stp_t_input_fp); stp_t_main_processing_len = strlen(u1_tp_line_buffer); vd_s_remove_trailing_newline(u1_tp_line_buffer, stp_t_main_processing_len); u4_t_main_processing_line = u4_s_process_s315_line( u1_tp_line_buffer, u1_tp_new_hex_addr, u1p_a_search_string); if ((U4)TRUE == u4_t_main_processing_line) { vd_s_address_pair(stp_t_output_fp, u1_tp_new_hex_addr); u4_t_target_found = (U4)TRUE; u4_t_main_processing_result = (U4)SUCCESS; break; } } if ((U4)FALSE == u4_t_target_found) { vd_s_write_default_address(stp_t_output_fp); printf(“Line %s not found\n”, u1p_a_search_string); } fclose(stp_t_output_fp); } fclose(stp_t_input_fp); } return u4_t_main_processing_result; } /===================================================================================================================================/ /* Function Name: main */ /* --------------------------------------------------------------------------------------------------------------------------------- */ /* Description: Program entry point. Handles user input, file processing, and retry logic. / / Requires 4-character prefix input. */ /* Arguments: None */ /* Return: U4 : SUCCESS (0) on success, WRONG (1) on failure */ /===================================================================================================================================/ U4 main(void) { U4 u4_t_return_code; U4 u4_t_test_status; U1 u1_tp_search_string[(U4)MAX_LINE_LENGTH]; U1 u1_tp_choice[(U4)FOUR]; U4 u4_t_retry = (U4)TRUE; U1* u1p_t_main_fgetsresulta; U1* u1p_t_main_fgetsresultb; U4 u4_t_main_strlena; U4 u4_t_main_strlenb; u4_t_return_code = (U4)WRONG; while (u4_t_retry) { printf("Enter the search prefix string: "); u1p_t_main_fgetsresulta = fgets(u1_tp_search_string, (U4)MAX_LINE_LENGTH, stdin); if (NULL == u1p_t_main_fgetsresulta) { u1p_t_main_fgetsresulta = fgets(u1_tp_search_string, (U4)MAX_LINE_LENGTH, stdin); printf(“Error: Failed to read input. Exiting.\n”); system(“pause”); return (U4)WRONG; } vd_s_remove_trailing_newline(u1_tp_search_string, strlen(u1_tp_search_string)); /* Validate non-empty input / u4_t_main_strlenb = strlen(u1_tp_search_string); if ((U4)ZERO == u4_t_main_strlenb) { printf(“Error: Search prefix cannot be empty.\n”); continue; } / Validate 4-character length requirement / u4_t_main_strlenb = strlen(u1_tp_search_string); if ((U4)FOUR != u4_t_main_strlenb) { printf(“Error: Prefix must be exactly 4 characters.\n”); continue; } printf(“Processing with search string: %s\n”, u1_tp_search_string); u4_t_test_status = u4_s_main_processing_task(u1_tp_search_string); if ((U4)SUCCESS == u4_t_test_status) { printf(“SUCCESS! Processed: %s\n”, u1_tp_search_string); u4_t_return_code = (U4)ZERO; break; } else { printf(“FAILED: No matching line found.\n”); / Retry prompt */ printf("Retry? (y/n): "); u1p_t_main_fgetsresultb = fgets(u1_tp_choice, sizeof(u1_tp_choice), stdin); if (NULL == u1p_t_main_fgetsresultb) { u1p_t_main_fgetsresultb = fgets(u1_tp_choice, sizeof(u1_tp_choice), stdin); printf(“Error: Input read failed. Exiting.\n”); break; } vd_s_remove_trailing_newline(u1_tp_choice, strlen(u1_tp_choice)); if (u1_tp_choice[(U4)ZERO] != ‘y’ && u1_tp_choice[0] != ‘Y’) { u4_t_retry = (U4)FALSE; } } } system(“pause”); return u4_t_return_code; } 把初始化函数部分改成入参形式
08-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值