应用程序在运行时崩溃并出现以下错误:
java.lang.IllegalArgumentException:maa.abc:针对 S+(版本 31 及更高版本)要求在创建 PendingIntent 时指定 FLAG_IMMUTABLE 或 FLAG_MUTABLE 之一。强烈考虑使用 FLAG_IMMUTABLE,仅当某些功能依赖于可变的 PendingIntent 时才使用 FLAG_MUTABLE,例如,如果需要与内联回复或气泡一起使用。在 android.app.PendingIntent.checkFlags(PendingIntent.java:375) 在 android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645) 在 android.app.PendingIntent.getBroadcast(PendingIntent.java:632) 在 com.google。 android.exoplayer2.ui.PlayerNotificationManager.createBroadcastIntent(PlayerNotificationManager.java:1373) 在 com.google.android.exoplayer2.ui.PlayerNotificationManager.createPlaybackActions(PlayerNotificationManager.java:1329) 在 com.google.android.exoplayer2.ui.PlayerNotificationManager。 (PlayerNotificationManager.java:643) 在 com.google.android.exoplayer2.ui.PlayerNotificationManager.(PlayerNotificationManager.java:529) 在 com.google.android.exoplayer2.ui.PlayerNotificationManager.createWithNotificationChannel(PlayerNotificationManager.java:456) 在 com .google.android.exoplayer2.ui.PlayerNotificationManager.createWithNotificationChannel(PlayerNotificationManager.java:417)
我尝试了所有可用的解决方案,但应用程序在 Android 12 上仍然崩溃。
@Nullable
@Override
public PendingIntent createCurrentContentIntent(@NonNull Player player) {
Intent intent = new Intent(service, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_SINGLE_TOP |
Intent.FLAG_ACTIVITY_NEW_TASK);
return PendingIntent.getActivity(service, 0, intent,PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试将下载功能添加到我的应用程序中我正在使用Glide Library从他们的url下载图片这是我在设备存储中保存图片但不能正常工作的代码与android 5.0.1和6.0一起工作正常.1但是在另一个Android版本中效果不佳
Toast.makeText(Pop.this, "Please wait ...", Toast.LENGTH_LONG).show();
new AsyncTask<FutureTarget<Bitmap>, Void, Bitmap>() {
@Override protected Bitmap doInBackground(FutureTarget<Bitmap>... params) {
try {
return params[0].get();
// get needs to be called on background thread
} catch (Exception ex) {
return null;
}
}
@Override protected void onPostExecute(Bitmap bitmap) {
if(bitmap == null) return;
MediaStore.Images.Media.insertImage(getContentResolver(), bitmap, "Art_"+System.currentTimeMillis(), "Beschrijving");
}
}.execute(Glide.with(getApplicationContext()).load(url).asBitmap().diskCacheStrategy(DiskCacheStrategy.SOURCE).into(width, height));
Run Code Online (Sandbox Code Playgroud)
请帮我
要录制SurfeceView我使用的 3rd-party library,该库需要一个路径,其中保存在我的案例中的输出(录制的视频)是savedVideoPath:
mRenderPipeline = EZFilter.input(this.effectBmp)
.addFilter(new Effects().getEffect(VideoMaker.this, i))
.enableRecord(savedVideoPath, true, false)
.into(mRenderView);
Run Code Online (Sandbox Code Playgroud)
录制停止后,视频应该以savedVideoPath为路径保存,当我测试代码时,也就是说,当我打开图库应用程序时,我在那里看到保存的视频,但是当我在Android Q上测试时,我什么也看不见。
由于getExternalStoragePublicDirectory和getExternalStorageDirectory已弃用,我尝试使用getExternalFilesDir如下:
private void getPath() {
String videoFileName = "video_" + System.currentTimeMillis() + ".mp4";
fileName = videoFileName;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
File imageFile = null;
File storageDir = new File(getExternalFilesDir(Environment.DIRECTORY_MOVIES), "Folder");
source = storageDir;
boolean success = true;
if (!storageDir.exists()) {
success = storageDir.mkdirs();
}
if (success) {
imageFile = new File(storageDir, …Run Code Online (Sandbox Code Playgroud) java android android-mediascanner android-external-storage android-10.0
更新以下依赖项后:
implementation 'com.google.firebase:firebase-inappmessaging-display:19.1.0'
implementation 'com.google.firebase:firebase-messaging:20.2.2'
implementation 'com.google.firebase:firebase-core:17.4.4'
Run Code Online (Sandbox Code Playgroud)
应用程序在运行时崩溃:
java.lang.AbstractMethodError: abstract method "com.google.android.gms.tasks.Task com.google.firebase.iid.WithinAppServiceBinder$IntentHandler.zza(android.content.Intent)"
at com.google.firebase.iid.WithinAppServiceBinder.zza(com.google.firebase:firebase-iid@@20.2.2:9)
at com.google.firebase.iid.zzaw.zza(com.google.firebase:firebase-iid@@20.2.2:30)
at com.google.firebase.iid.zzaw.onServiceConnected(com.google.firebase:firebase-iid@@20.2.2:59)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1830)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1859)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:101)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
Run Code Online (Sandbox Code Playgroud) 我正在尝试向我的应用程序提交更新,在上传Android 应用程序包后,我收到此错误消息:
在分析了Android App bundle之后,我已经阅读了文档并遵循了所有步骤:
我的应用程序是一个照片编辑器应用程序,纯java,我没有使用任何本机代码,但我使用了一些第三方库,例如
implementation 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1'
Run Code Online (Sandbox Code Playgroud)
如上图所示,它支持 64 位
这是我的 Gradle 文件:
android {
compileSdkVersion 29
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "maa.abc"
minSdkVersion 18
targetSdkVersion 29
versionCode 14
versionName "1.2.0"
multiDexEnabled true
renderscriptTargetApi 28
renderscriptSupportModeEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64' 'armeabi'
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility …Run Code Online (Sandbox Code Playgroud) 我正在尝试反映像这样绘制的贴纸
\n原创贴纸----------反光贴纸
\n \xe2\x86\x93 \xe2\x86\x93\nRun Code Online (Sandbox Code Playgroud)\n
\npublic void reflectCurrentSticker(int windowWidth) {\n\n // Y\n // ----|----- x\n // |\n\n //creation of the cloned sticker\n //getWidth() == width of the FrameLayout (where the stickers drawn)\n\n Matrix originalMatrix = getReflectedMatrix(getWidth(), originalSticker);\n addSticker(clonedSticker);\n clonedSticker.setMatrix(originalMatrix);\n invalidate();\n\n}\n\npublic Matrix getReflectedMatrix(int wrapperWidth, Sticker sticker) {\n Matrix matrix = sticker.getMatrix();\n float transX = getMatrixValue(matrix, 2);\n float transY = getMatrixValue(matrix, 5);\n float newX = (((float) wrapperWidth) - transX) - ((float) sticker.getCurrentWidth());\n float currentAngle = sticker.getCurrentAngle();\n float …Run Code Online (Sandbox Code Playgroud) Exoplayer最新更新com.google.android.exoplayer:exoplayer:2.10.1我注意到,该setNotificationListener方法现在已经过时了,文件说:
@param notificationListener {@link NotificationListener}。@deprecated将通知侦听器传递给构造函数。
我不明白,应该在其上放置侦听器的构造函数在哪里?
void exoPlayerNotification(Context context, SimpleExoPlayer exoPlayer, String title) {
String titlesonge;
String artist;
try {
titlesonge = StringUtils.substringBefore(title, " - ");
artist = StringUtils.substringAfter(title, " - ");
} catch (Exception e) {
titlesonge = title.substring(0, title.indexOf(" - "));
artist = title.substring(title.lastIndexOf(" - ") - 1);
}
String finalArtist = artist;
String finalTitlesonge = titlesonge;
PlayerNotificationManager mPlayerNotificationManager = PlayerNotificationManager.createWithNotificationChannel(
context,
"PRIMARY_CHANNEL_ID",
R.string.plaza,
NOTIFICATION_ID,
new PlayerNotificationManager.MediaDescriptionAdapter() {
@Override
public String getCurrentContentTitle(Player player) { …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用NetBeans 11.0生成(.JAR)文件,我遵循了一些答案,例如如何在 Netbeans 中创建 Jar 文件,但我没有在 Build 下找到 Packaging,我也尝试Clean & Build Project但是我找不到文件夹。/dist
谁能帮我
日志 :
Scanning for projects...
------------------------------------------------------------------------
Building FlickerURLMaker 1.0-SNAPSHOT
------------------------------------------------------------------------
--- maven-clean-plugin:2.5:clean (default-clean) @ FlickerURLMaker ---
Deleting C:\Users\USER\Documents\NetBeansProjects\FlickerURLMaker\target
--- maven-resources-plugin:2.6:resources (default-resources) @ FlickerURLMaker ---
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory C:\Users\USER\Documents\NetBeansProjects\FlickerURLMaker\src\main\resources
--- maven-compiler-plugin:3.1:compile (default-compile) @ FlickerURLMaker ---
Changes detected - recompiling the module!
Compiling 2 source files to C:\Users\USER\Documents\NetBeansProjects\FlickerURLMaker\target\classes
--- maven-resources-plugin:2.6:testResources (default-testResources) @ …Run Code Online (Sandbox Code Playgroud) 我正在尝试将视频保存到图库,以下代码适用于除Android Q之外的所有 Android 版本:
private void getPath() {
String videoFileName = "video_" + System.currentTimeMillis() + ".mp4";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
ContentResolver resolver = getContentResolver();
ContentValues contentValues = new ContentValues();
contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, videoFileName);
contentValues.put(MediaStore.MediaColumns.MIME_TYPE, "video/mp4");
contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, "Movies/" + "Folder");
contentValues.put(MediaStore.Video.Media.IS_PENDING, 1);
Uri collection = MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY);
Uri videoUri = resolver.insert(collection, contentValues);
if (videoUri != null) {
try (ParcelFileDescriptor pfd = resolver.openFileDescriptor(videoUri, "w", null)) {
OutputStream outputStream = null;
if (pfd != null) {
outputStream = resolver.openOutputStream(videoUri);
outputStream.flush();
outputStream.close();
}
} …Run Code Online (Sandbox Code Playgroud) android ×8
java ×8
android-10.0 ×2
exoplayer2.x ×2
64-bit ×1
android-12 ×1
build.gradle ×1
firebase ×1
google-play ×1
gpuimage ×1
jar ×1
matrix ×1
mediastore ×1
netbeans ×1
netbeans-11 ×1
save ×1