release-apk 相关问题


强制 Gradle 在不清理的情况下组装 APK

与强制 gradle 生成 apk 类似,我想强制 Gradle 生成 apk,以防先前的构建已被移动或删除。我很好奇是否可以在构建目录时执行...


如何在 Linux ARM64 上构建 Chrome V8?

我正在尝试在 Ubuntu 22.04 ARM64 上构建 V8。我尝试通过便利脚本进行构建,即tools/dev/gm.py arm64.release,以及tools/dev/v8gen.py arm64.release,但没有成功(clang


上传 Google Play 商店时,APK 已使用不安全的密钥大小进行签名

我已经在android studio中生成了带有发布证书的APK。上传 Intune Google Play 商店时出现以下错误, APK 已使用不安全的密钥大小进行签名。 请指导我


Azure Devops - 存储库中每个分支都有一个计划管道

是否可以使用一个管道并将其安排到存储库中以“release”开头的所有分支? 我的场景: 一个存储库 - TestRepo。 TestRepo 的多个发布分支:release/


为什么我不断收到错误消息,提示我上传了在调试模式下签名的 APK?

“您上传了一个在调试模式下签名的 APK。您需要在发布模式下签署您的 APK” 伙计们,我想我正在失去它。我第一次尝试将应用程序上传到 Goo...


如何反编译kotlin android apk?

我有自己用 kotlin 开发的 Android 应用程序。在我使用下面的 adb 命令从物理 Android 设备中提取我的 apk 后,我丢失了所有源代码(硬盘崩溃) - c:\> adb shell pm...


我应该使用什么密钥密码来签署 React Native 项目?

我在React Native中制作了一个应用程序项目,我想构建它的apk。我正在关注官方文档,如下所示:https://reactnative.dev/docs/signed-apk-android。 它说我必须...


React Native:POST 请求在开发中有效,但在 EAS 构建 APK 中无效

我的 React Native 应用程序面临一个问题,当我使用 npx expo start 运行应用程序时,POST 请求可以完美工作,但当我使用 EAS Build 构建 APK 时,它无法按预期工作,并且 i.. .


使用Android的buildozer编译基于kivy的apk应用程序,要求bcrypt返回错误ModuleNotFoundError:没有名为'setuptools_rust'的模块

我是新手所以请原谅我的无知.. 我正在尝试按照 kivy 说明和 buildozer 文档中的步骤使用 buildozer 编译基于 kivy 的 apk,我已经编辑了 buildoze...


在 ec2 中安装节点,Amazon Linux2 错误 glibc >= 2.28

尝试在以下位置安装 npm 和 node: 猫 /etc/os-release 名称=“亚马逊Linux” 版本=“2” ID=“amzn” ID_LIKE="centos rhel fedora" 版本_ID=“2” 漂亮...


无法获取Linux存储库[重复]

相当简单的问题。为什么我无法克隆这个确实存在的 Linux 存储库? $ git克隆 git://github.com/nxp-auto-linux/linux;protocol=https;branch=release/bsp36.0-5.15.85-rt 克隆到 '


Bitbucket 分支限制(名称模式)

如何将提交或拉取请求限制为分支模式。例如: 我想限制此模式发布/冲刺-* 但 我想启用release/sprint-35 如果我给出这个模式发布/...


Cargo lambda 构建找不到 OpenSSL 开发标头

我正在尝试使用cargo-lambda 在Rust 中为AWS 编写一个lambda 函数。当我调用cargo lambda build --release --arm64 时,cargo lambda new 生成的示例函数构建得很好。然而,我们...


如何使用 C# 开发套件在 Visual Studio Code 中设置 dotnet Release 配置构建?

我已经安装了 Visual Studio Code 和“C# Dev Kit”。看起来没有默认的方式让人们选择发布配置构建。 查看文档包,它提到了 a...


Flutter 中可以使用什么包来代替 open_file?

我在 Flutter 中有一个项目,我正在使用 open_file 包。我已将 Flutter 生成的 Android apk 上传到 AppSweep,它返回以下问题:Insecure file location is retr...


如何更新 Play 商店应用程序包的包名称?

我按照步骤为我的 Flutter 应用程序签署了捆绑包。 比我将 build/app/outputs/bundle/release/app-release.aab 拖到 Google Play 控制台的应用程序包中,并收到错误 You need to use a different


GitHub Packages:无效的发布“release”:具有相同扩展名和分类器的多个工件(“aar”、“null”)

我一直在尝试通过 GitHub Packages 发布该库,为此我正在关注这篇 Medium 文章:将 Android 库发布到 GitHub Packages 这是我的 build.gradle 文件: 导入...


未从 PackageInstaller 获取状态更新

我正在尝试使用 PackageInstaller 来安装 apk,当我将会话提交到包安装以开始安装过程时,我的广播接收器获得了操作,但没有任何额外的...


API 不工作/http 错误 SocketException:在发布版本中查找主机失败(在调试模式下工作)对于 Flutter

获取有关 path_provider-1.5.1 和 API 不工作的一些注释,我通过 http/dio 在 Release Build(在调试模式下工作)中集成了 Flutter。 笔记: /home/webelightpc/文档/


无法解析所有配置文件':app:androidJdkImage

我正在尝试从 android studio 在调试模式下构建 flutter apk。 颤振运行 我收到此错误: 在调试模式下在 sdk gphone x86 arm 上启动 lib/main.dart... 运行 Gradle 任务“assembleDebug”...


Alpine Linux 容器上的 Flutter 安装无法“pub 升级”

我想在运行 Alpine Linux 的 Docker 容器上安装 Flutter。 我编写了以下 Dockerfile: 来自阿尔卑斯山 运行 apk 添加 bash 卷曲文件 git zip 运行 git 克隆 https://github.com/flutter/


如何从 Gitlab 管道触发 browserstack 构建,并获取结果 - 通过/失败

我们有一个Android项目,正在使用Appium和Browserstack一起进行UI测试。通过 Gitlab 将 APK 上传到 Browserstack 非常简单。但是触发appium测试,然后...


在批处理文件中运行多个启动命令

我在批处理文件中有多个启动命令,我想一一运行命令。我怎样才能实现它? 第一个命令生成 apk 文件,其他命令重命名该文件。我想先跑...


android 高度隐藏布局的所有视图

我的布局如下面的屏幕截图所示。 我的代码如下。 我的布局如下面的屏幕截图所示。 我的代码如下。 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" > <LinearLayout android:id="@+id/ll_main" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="@dimen/margin_smallxx" android:layout_marginTop="@dimen/margin_normalxx" android:layout_marginEnd="@dimen/margin_smallxx" android:orientation="vertical"> ....... 现在我想为盒子添加阴影,如下所示。 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" > <TextView style="@style/shadowStyle" android:elevation="20dp" android:layout_alignTop="@id/ll_main" android:layout_alignBottom="@id/ll_main" android:layout_alignStart="@id/ll_main" android:layout_alignEnd="@id/ll_main" /> <LinearLayout android:id="@+id/ll_main" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="@dimen/margin_smallxx" android:layout_marginTop="@dimen/margin_normalxx" android:layout_marginEnd="@dimen/margin_smallxx" android:orientation="vertical"> shadowStyle如下。 <style name="shadowStyle" parent="@android:style/TextAppearance"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">match_parent</item> <item name="android:text"></item> <item name="android:background">@drawable/myrect</item> <item name="android:outlineSpotShadowColor">@color/shadow_color</item> </style> 和myrect.xml形状如下。 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#FFFFFF" /> <corners android:radius="20dp" /> </shape> 当我添加此内容时,下面的所有视图都会被隐藏,这很奇怪。 应用程序截图如下。 我将 shadow_color 表示为 #FF00FF 仅用于测试目的。 知道如何使其正确吗?我是不是错过了什么... 以下是我根据mãĴď评论所做的事情 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@color/white"> <androidx.cardview.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="@dimen/margin_smallxx" android:layout_marginTop="@dimen/margin_normalxx" android:layout_marginEnd="@dimen/margin_smallxx" app:cardCornerRadius="10dp" app:cardElevation="20dp" android:outlineSpotShadowColor="@color/shadow_color" > <LinearLayout android:id="@+id/ll_main" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> ........ </LinearLayout> </CardView> </RelativeLayout> 这意味着我们将拥有卡片视图并将整个布局放入其中......


活动深层链接 - IllegalArgumentException:缺少必需的参数并且没有 android:defaultValue

在我的应用程序中,我有以下结构: 在我的应用程序中,我具有以下结构: <!-- AndroidManifest.xml --> <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"> <application> <activity android:name=".DeepLinkActivity" android:exported="true" android:launchMode="singleInstancePerTask"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:host="myhost" android:path="/mypath" android:scheme="myscheme" /> </intent-filter> </activity> </application> </manifest> <!-- activity_deep_link.xml --> <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.fragment.app.FragmentContainerView android:id="@+id/navHostFragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android:layout_height="match_parent" app:defaultNavHost="true" tools:navGraph="@navigation/my_nav_graph" /> </FrameLayout> // DeepLinkActivity.kt class DeepLinkActivity : AppCompatActivity() { private lateinit var binding: ActivityDeepLinkBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityDeepLinkBinding.inflate(layoutInflater) setContentView(binding.root) setUpNavigationGraph() } private fun setUpNavigationGraph() { val navHostFragment = supportFragmentManager .findFragmentById(binding.navHostFragment.id) as NavHostFragment val navController = navHostFragment.navController val navGraph = navController.navInflater .inflate(R.navigation.my_nav_graph) .apply { this.setStartDestination(R.id.notTheStartDestinationFragment) } val startDestinationArgs = bundleOf( "someRequiredArgumentHere" to false ) navController.setGraph(navGraph, startDestinationArgs) } } 当我通过 ADB (adb shell am start -d myscheme://myhost/mypath) 通过深度链接打开该活动时,该活动正常启动。 但是当我通过 Chrome 应用程序启动它时,应用程序崩溃了: 原因:java.lang.IllegalArgumentException:缺少必需参数“someRequiredArgumentHere”并且没有 android:defaultValue 观察:我正在使用 Safe Args 插件。 我做错了什么以及为什么行为不同? 我刚刚发现为什么在通过浏览器导航时会忽略 startDestinationArgs。 如果我们检查NavController#setGraph(NavGraph, Bundle?)的内部代码,如果没有发生深层链接,NavController#onGraphCreated(Bundle?)只会使用startDestinationArgs。 作为一种解决方法,在设置导航图之前,我只需清除活动的意图(但这可能不是解决该问题的最佳方法)


AnimationSet 未按预期执行顺序动画

如果我手动执行多个连续动画。它按预期工作。这是我的可行代码 扩展.xml 如果我手动执行多个连续动画。它按预期工作。这是我的可行代码 scale_up.xml <?xml version="1.0" encoding="utf-8"?> <scale xmlns:android="http://schemas.android.com/apk/res/android" android:fromXScale="1.0" android:fromYScale="1.0" android:toXScale="1.1" android:toYScale="1.1" android:pivotX="50%" android:pivotY="50%" android:fillAfter="true" android:interpolator="@android:anim/decelerate_interpolator" android:duration="@android:integer/config_shortAnimTime" /> scale_down.xml <?xml version="1.0" encoding="utf-8"?> <scale xmlns:android="http://schemas.android.com/apk/res/android" android:fromXScale="1.1" android:fromYScale="1.1" android:toXScale="1.0" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:fillAfter="true" android:interpolator="@android:anim/decelerate_interpolator" android:duration="@android:integer/config_shortAnimTime" /> 手动执行连续动画 public void startAnimation(Button button) { // Define the scale up animation Animation scaleUpAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_up); // Define the scale down animation Animation scaleDownAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_down); scaleUpAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { button.startAnimation(scaleDownAnimation); } @Override public void onAnimationRepeat(Animation animation) { } }); button.startAnimation(scaleUpAnimation); } 结果 但是,如果我尝试使用 AnimationSet 替换上述代码,动画结果就会损坏。 public void startAnimation(Button button) { // Define the scale up animation Animation scaleUpAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_up); // Define the scale down animation Animation scaleDownAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_down); // Create an AnimationSet to combine both animations // (It makes no difference whether I am using true or false) AnimationSet animationSet = new AnimationSet(true); animationSet.addAnimation(scaleUpAnimation); animationSet.addAnimation(scaleDownAnimation); // Apply the animation to the button button.startAnimation(animationSet); } 使用AnimationSet的结果(动画不流畅) 我可以知道为什么AnimationSet不起作用吗?谢谢。 我们需要使用setStartOffset来延迟第二个动画的执行。这是解决上述问题的完整代码片段。 public void startAnimation(Button button) { int config_shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); // Define the scale up animation ScaleAnimation scaleUpAnimation = new ScaleAnimation( 1f, 1.02f, 1f, 1.02f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f ); scaleUpAnimation.setInterpolator(new DecelerateInterpolator()); scaleUpAnimation.setDuration(config_shortAnimTime); scaleUpAnimation.setFillAfter(true); // Define the scale down animation ScaleAnimation scaleDownAnimation = new ScaleAnimation( 1.02f, 1f, 1.02f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f ); scaleDownAnimation.setInterpolator(new AccelerateInterpolator()); scaleDownAnimation.setDuration(config_shortAnimTime); scaleDownAnimation.setFillAfter(true); scaleDownAnimation.setStartOffset(scaleUpAnimation.getDuration()); // Create an AnimationSet to combine both animations AnimationSet animationSet = new AnimationSet(false); animationSet.addAnimation(scaleUpAnimation); animationSet.addAnimation(scaleDownAnimation); // Apply the animation to the button button.startAnimation(animationSet); }


如何在 C++/WinRT (WinUI3) 中将图像从内存读取到 ImageSource?

[1] 我想在 XAML 中显示 Image 控件的图像,但该图像来自字节数组。 我应该怎么办?图像格式可以是JPG、BMP或PNG之一。 [1] 我想在 XAML 中显示 Image 控件的图像,但该图像来自字节数组。 我该怎么办?图像格式可以是 JPG、BMP 或 PNG 之一。 <Image x:Name="img"/> void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&) { unsigned long long size; // iamge data size const unsigned char* buf; // image data img().Source(???); // what should I do? } [2] 我尝试了InMemoryRandomAccessStream,但没有成功。 我知道在C#中使用MemoryStream很方便,但是如何在C++中实现它? 另一个问题是这个方法是否也适用于JPG和PNG格式的图像? void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&) { unsigned long long size; // iamge data size const unsigned char* buf; // image data winrt::Microsoft::UI::Xaml::Media::Imaging::BitmapImage bmp; winrt::Windows::Storage::Streams::InMemoryRandomAccessStream stream; // How to read data from stream? bmp.SetSource(stream); img().Source(bmp); } [3] 现在功能已经实现了,但是还有两个问题 IAsyncAction MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&) { unsigned long long size; // iamge data size const unsigned char* buf; // image data winrt::Microsoft::UI::Xaml::Media::Imaging::BitmapImage bmp; winrt::Windows::Storage::Streams::InMemoryRandomAccessStream stream; winrt::Windows::Storage::Streams::DataWriter dw(st.GetOutputStreamAt(0ULL)); dw.WriteBytes({ buf, size }); // This is very inefficient! co_await dw.StoreAsync(); dw.Close(); bmp.SetSource(stream); img().Source(bmp); stream.Close(); } 首先,我发现DataWriter::WriteBytes()确实是在复制数据。但我认为ImageSource只需要从我的buf中读取即可,不需要在读取之前将整个图像完全复制到流中。也许是类似MemoryView的东西,我这样想是不是错了? 其次,DataWriter和InMemoryRandomAccessStream的Close()应该在哪里调用? BitmapImage需要释放内存吗?这里有一个异步函数,我不知道应该写在哪里 [4] 根据IInspectable,我尝试了SHCreatMemStream并搜索了大量信息以提出另一个解决方案。目前的问题是,与方法[3]同样可行,但仍然会出现内存分配问题。 #include "Shlwapi.h" #include "shcore.h" #pragma comment(lib, "shlwapi.lib") void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&) { unsigned long long size; // iamge data size const unsigned char* buf; // image data winrt::Microsoft::UI::Xaml::Media::Imaging::BitmapImage bmp; IStream* stream{ SHCreateMemStream(buf, size) }; // Copying takes a lot of time static const GUID guidIRandomAccessStream = { 0x905a0fe1, 0xbc53, 0x11df, { 0x8c, 0x49, 0x00, 0x1e, 0x4f, 0xc6, 0x86, 0xda } }; winrt::Windows::Storage::Streams::IRandomAccessStream pRas{ }; CreateRandomAccessStreamOverStream(stream, BSOS_OPTIONS::BSOS_DEFAULT, guidIRandomAccessStream, (void**)&pRas); bmp.SetSource(stream); img().Source(bmp); } 通过性能测试,发现CreateRandomAccessStreamOverStream的时间是一致的,但是SHCreateMemStream消耗的时间与图像大小成正比。可以得出,SHCreateMemStream中创建流的过程也涉及到内存的复制。 我对Windows编程中的Stream不是特别熟悉。创建流的过程一定会涉及到内存复制吗?从内存加载图像可以避免额外的开销吗?还有没有类似MemoryStreamView的结构来替代吗? 还有一个问题,我知道新的图像肯定需要内存存储。 BitmapImage设置Stream为Source会接管Stream占用的内存吗? Image控件设置BitmapImage作为Source会接管BitmapImage占用的内存吗? 如果是这样的话,我可以接受Stream分配新的内存,否则仍然是一个效率问题。 谢谢!!!!!!! 使用Stream已经彻底解决了这个问题。如前四期所述。 至于附加问题: ★1 使用 CreatStreamOnHGlobal 而不是 SHCreatMemStream。 因为SHCreatMemStream在调用过程中会对传入的内存块参数进行另一次内存复制。 CreatStreamOnHGlobal 创建流后不执行内存复制。您可以先通过GlobalAlloc分配内存,写入所需的图像数据,然后调用CreatStreamOnHGlobal,无需任何时间开销。另外,可以将CreatStreamOnHGlobal的第二个参数设置为true,自动释放GlobalAlloc分配的内存。 通过进程内存监控,我发现对于同一个程序,使用CreatStreamOnHGlobal的速度是SHCreatMemStream的两倍,并且不会导致内存泄漏。 ★2 创建的Stream需要调用Release方法减少一个引用。 IRandomAccessStream作为局部变量,会自动析构,无需主动释放。 并且BitmapImage还管理一部分引用,这些引用在离开作用域后被释放。 通过测试COM对象上Release方法的返回值,发现整个程序结束后引用计数又回到了0


Spring boot + slf4j + log4j + 类 org.apache.logging.slf4j.SLF4JLoggerContext 无法转换为类

我有Spring boot 2.3.1 pom.xml 我有Spring boot 2.3.1 pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.1.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>logger</groupId> <artifactId>logger</artifactId> <version>0.0.1-SNAPSHOT</version> <name>logger</name> <description>Demo project for Spring Boot</description> <properties> <java.version>11</java.version> <lombok.version>1.18.12</lombok.version> <log4j.version>1.2.17</log4j.version> <slf4j.version>1.7.30</slf4j.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <artifactId>logback-classic</artifactId> <groupId>ch.qos.logback</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>${slf4j.version}</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>${log4j.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> 班级 @Slf4j @SpringBootApplication public class LoggerApplication { public static void main(String[] args) { log.info("++++++++++++++++++++++++TEST+++++++++++++++++++++++++++++"); SpringApplication.run(LoggerApplication.class, args); } } 应用程序.属性 logging.config=classpath:log4j.properties log4j.properties log4j.rootLogger=INFO, console log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.Target=System.out log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p - %m%n 我尝试寻找解决方案,查看论坛上的类似主题,尝试各种排除依赖项的选项。 线程“main”中的异常 java.lang.ClassCastException:类 org.apache.logging.slf4j.SLF4JLoggerContext 无法转换为类 org.apache.logging.log4j.core.LoggerContext (org.apache.logging.slf4j.SLF4JLoggerContext 和 org.apache.logging.log4j.core.LoggerContext 位于未命名模块中 加载器“应用程序”)位于 我还尝试排除一些依赖项 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <artifactId>logback-classic</artifactId> <groupId>ch.qos.logback</groupId> </exclusion> <exclusion> <groupId>log4j</groupId> <artifactId>*</artifactId> </exclusion> <exclusion> <groupId>org.slf4j</groupId> <artifactId>*</artifactId> </exclusion> <exclusion> <groupId>org.apache.logging.log4j</groupId> <artifactId>*</artifactId> </exclusion> </exclusions> </dependency> 但又出现错误,但现在无法再格式化日志了。 2021-01-13 19:12:15,881 信息 - ++++++++++++++++++++++++测试+++++++++++++++++++++++++++++++ 错误 StatusLogger 无法识别的格式说明符 [d] 错误 StatusLogger 无法识别的转换说明符 [d] 从转换模式中的位置 16 开始。 错误 StatusLogger 无法识别的格式说明符 [线程] 错误 StatusLogger 无法识别的转换说明符 [线程] 从转换模式中的位置 25 开始。 错误 StatusLogger 无法识别的格式说明符 [级别] 错误 StatusLogger 无法识别的转换说明符 [level] 从转换模式中的位置 35 开始。 ... 错误 StatusLogger 无法识别的格式说明符 [n] 错误 StatusLogger 无法识别的转换说明符 [n] 从转换模式中的位置 56 开始。 警告:不支持 sun.reflect.Reflection.getCallerClass。这会影响性能。 任何人都可以有任何想法如何解决它吗? 我找到了解决这个问题的方法。事实证明,问题出在其中一个私有库(elastik 的附加程序)的冲突上。 我执行了命令: mvn dependency:tree 然后找到传递依赖项,并将它们排除在所有类的路径上,以排除日志记录所需的库冲突。 pom.xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <artifactId>logback-classic</artifactId> <groupId>ch.qos.logback</groupId> </exclusion> <exclusion> <artifactId>log4j-to-slf4j</artifactId> <groupId>org.apache.logging.log4j</groupId> </exclusion> </exclusions> </dependency> <dependency> <artifactId>springfox-boot-starter</artifactId> <groupId>io.springfox</groupId> <version>3.0.0</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>${log4j.version}</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>${version.log4j.core}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>${slf4j.version}</version> </dependency>


为什么 Android 上两个组件之间的切换速度如此之慢?

我正在使用 Expo/React Native/Typescript 构建一个类似于填字游戏的小型拼图应用程序。 这是 PuzzleMain 组件的精简版本: const PuzzleMain:React.FC 我正在使用 Expo/React Native/Typescript 构建一个类似于填字游戏的小型拼图应用程序。 这是 PuzzleMain 组件的精简版本: const PuzzleMain: React.FC<PuzzleMainProps> = ({ navigation }) => { let puzzle: AcrosticPuzzleData = parseAcrosticPuzzle(PUZZLE_TEXT); const grid = <PuzzleGrid puzzle={puzzle} />; const clueView = <PuzzleCluesView puzzle={puzzle} />; const [index, setIndex] = React.useState(0); return <View style={styles.container}> {index == 0 ? grid : clueView} <View style={styles.keyboardContainer}> <Button onPress={() => setIndex(index == 1 ? 0 : 1)} title={"See " + routes[index == 0 ? "Grid" : "Clues"].key} /> <Keyboard /> </View> </View>; } 总结一下,有“网格”组件和“线索”组件,并通过按钮在它们之间进行切换。 毫不夸张地说,在我用来测试的 Pixel 5 上点击此按钮大约需要 3 秒的时间才能进行更改。我在这里做错了什么?使用Expo在网络上打开这个,它立即发生,所以可能它是Android特有的? 我尝试过的事情: 记住 PuzzleGrid 和 PuzzleCluesView 组件(const PuzzleGrid: React.FC<Props> = memo(({ puzzle }) ...。这基本上没有什么区别。我检查过,在我为备忘录功能制作的自定义拼图比较器中没有打印任何内容,所以我认为它没有重新渲染。 改用 TabView 在组件之间滑动 - 这有效!但说实话,我真的更喜欢两者兼得,而且当我将其合并到 TabView 实现中时,按钮同样很慢。 使用 npx expo start --no-dev 并仅构建一个 apk 并安装 - 这使得速度更快,但仍然可能需要整整一两秒,这太慢了。 正如我所看到的,您正在执行条件渲染,因此每次条件更改时,整个组件都会被创建为新组件。这种方法会使渲染速度变慢,具体取决于组件的重量。 为什么备忘录不起作用? Memo 是一种优化技术,并不能保证性能提升。 现在,提升加载速度 内部优化PuzzleGrid和PuzzleCluesView,比如每个可以接收重复道具的子组件都会被memo覆盖,重型物品会异步加载,使用loader。 使用 InteractionManager 提高加载速度,并帮助显示加载程序而不冻结 UI。 不要卸载组件,而是重叠它们并使用可见性,因为可见性不会卸载组件 而不仅仅是 {index == 0 ? grid : clueView}你可以尝试类似的事情 <View> {grid} <View style={{ // Add height and other required props to make it visible position: 'absolute', visibility: index == 0 ? 'hidden' : 'visible', }}> {clueView} </View> </View>


SecurityException:不允许启动服务Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (有额外功能)}

我尝试从 Google 获取我的 GCM 注册 ID。 我的代码: 字符串SENDER_ID =“722*****53”; /** * 向 GCM 服务器异步注册应用程序。 * * 存储注册信息... 我尝试从 Google 获取我的 GCM 注册 ID。 我的代码: String SENDER_ID = "722******53"; /** * Registers the application with GCM servers asynchronously. * <p> * Stores the registration ID and the app versionCode in the application's * shared preferences. */ private void registerInBackground() { new AsyncTask<Void, Void, String>() { @Override protected String doInBackground(Void... params) { String msg = ""; try { if (gcm == null) { gcm = GoogleCloudMessaging.getInstance(context); } regid = gcm.register(SENDER_ID); msg = "Device registered, registration ID=" + regid; // You should send the registration ID to your server over // HTTP, so it // can use GCM/HTTP or CCS to send messages to your app. sendRegistrationIdToBackend(); // For this demo: we don't need to send it because the // device will send // upstream messages to a server that echo back the message // using the // 'from' address in the message. // Persist the regID - no need to register again. storeRegistrationId(context, regid); } catch (IOException ex) { msg = "Error :" + ex.getMessage(); // If there is an error, don't just keep trying to register. // Require the user to click a button again, or perform // exponential back-off. } return msg; } @Override protected void onPostExecute(String msg) { mDisplay.append(msg + "\n"); } }.execute(null, null, null); } 我收到错误: 03-01 19:15:36.261: E/AndroidRuntime(3467): FATAL EXCEPTION: AsyncTask #1 03-01 19:15:36.261: E/AndroidRuntime(3467): java.lang.RuntimeException: An error occured while executing doInBackground() 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.os.AsyncTask$3.done(AsyncTask.java:299) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.setException(FutureTask.java:219) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.run(FutureTask.java:239) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.lang.Thread.run(Thread.java:841) 03-01 19:15:36.261: E/AndroidRuntime(3467): Caused by: java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (has extras) } without permission com.google.android.c2dm.permission.RECEIVE 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.app.ContextImpl.startServiceAsUser(ContextImpl.java:1800) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.app.ContextImpl.startService(ContextImpl.java:1772) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.content.ContextWrapper.startService(ContextWrapper.java:480) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.google.android.gms.gcm.GoogleCloudMessaging.b(Unknown Source) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.google.android.gms.gcm.GoogleCloudMessaging.register(Unknown Source) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.example.gcm.DemoActivity$1.doInBackground(DemoActivity.java:177) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.example.gcm.DemoActivity$1.doInBackground(DemoActivity.java:1) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.os.AsyncTask$2.call(AsyncTask.java:287) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 03-01 19:15:36.261: E/AndroidRuntime(3467): ... 4 more 这是我的清单: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.manyexampleapp" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="com.example.manyexampleapp.c2dm.permission.RECEIVE" /> <uses-permission android:name="com.example.manyexampleapp.gcm.permission.C2D_MESSAGE" /> <permission android:name="com.example.manyexampleapp.gcm.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <application android:name="com.zoomer.ifs.BaseApplication" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <activity android:name="com.zoomer.ifs.MainActivity" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|screenSize" android:launchMode="singleTop"> <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <!-- PUSH --> <!-- WakefulBroadcastReceiver that will receive intents from GCM services and hand them to the custom IntentService. The com.google.android.c2dm.permission.SEND permission is necessary so only GCM services can send data messages for the app. --> <receiver android:name="com.example.gcm.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" > <intent-filter> <!-- Receives the actual messages. --> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <category android:name="com.example.manyexampleapp" /> </intent-filter> </receiver> <service android:name="com.example.gcm.GcmIntentService" /> <activity android:name="com.example.gcm.DemoActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- DB --> <activity android:name="com.example.db.DbActivity" android:label="@string/app_name" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.http.RestGetActivity" android:label="@string/app_name" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" > </activity> <activity android:name="com.example.fb.FacebookLoginActivity" android:label="@string/app_name" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <activity android:name="com.example.http.SendFeedbackActivity" android:label="@string/app_name" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <activity android:name="com.zoomer.general.SearchNearbyOffersActivity" android:label="@string/app_name" > <intent-filter> </intent-filter> </activity> <activity android:name="com.facebook.LoginActivity" android:label="@string/app_name" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.manyexampleapp.StoresListActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.fb.ShareActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.notifications.NotificationsActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.fb2.no_use.MainActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.zoomer.offers.OffersListActivity" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <activity android:name="com.example.http.SearchNearbyOffersActivity" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <service android:name="com.example.geo.LocationService" android:enabled="true" /> <receiver android:name="com.example.manyexampleapp.BootReceiver" > <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="com.example.manyexampleapp.LocationService.LOCATION_BROAD_MSG" /> </intent-filter> </receiver> <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id" /> </application> </manifest> 改变 <uses-permission android:name="com.example.manyexampleapp.c2dm.permission.RECEIVE" /> 到 <!-- This app has permission to register and receive data message. --> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> 您收到异常是因为您尚未定义所需的权限 如果应用程序开发后安装了播放服务, 可能会发生 com.google.android.c2dm.permission.RECEIVE 权限已被授予但 android 仍在抱怨同样的错误。 在这种情况下,您必须完全重新安装开发的应用程序才能使此权限发挥作用。 我认为你必须检查 Kotlin 版本兼容性。


© www.soinside.com 2019 - 2024. All rights reserved.