我的 apk 文件大小是 5MB
添加"de.mrmaffen:vlc-android-sdk:2.0.6"到 gradle 后,apk 大小增加到 62MB。
我该如何解决?
注意:我把它改成了这个,但是没有用。
compile ("de.mrmaffen:vlc-android-sdk:2.0.6"){
exclude group: 'io.card'
}
Run Code Online (Sandbox Code Playgroud) 我目前正在开发一个Flutter应用程序,推荐该地区的餐馆。但是,我陷入了困境。
为了组织和整洁,我希望我的应用程序的AppBar代码与每个屏幕的代码分开。因此,我将KainAppBar.dart构建为AppBar代码。如图所示:
import 'package:flutter/material.dart';
import 'package:gradient_app_bar/gradient_app_bar.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:google_sign_in/google_sign_in.dart';
GoogleSignIn _googleSignIn = GoogleSignIn(
signInOption: SignInOption.standard,
);
class KainAppBar extends StatelessWidget {
final String title;
KainAppBar(this.title);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: new GradientAppBar(
centerTitle: true,
title: new Text('Kain',
style: TextStyle(
fontFamily: 'Quiapo', fontSize: 36.0, fontWeight: FontWeight.w600
)),
backgroundColorStart: Colors.red[400],
backgroundColorEnd: Colors.red[900],
),
drawer: new Drawer(
child: ListView(
children: <Widget>[
new UserAccountsDrawerHeader(
decoration: BoxDecoration(
color: Colors.red[800],
),
accountName: new Text('Guest'),
accountEmail: new Text('guestemail@email.com'),
currentAccountPicture: new CircleAvatar( …Run Code Online (Sandbox Code Playgroud) Cannot resolve class android.support.v4.widget.DrawerLayout即使在我的 build.gradle 文件中添加了 DrawerLayoutandroidx.drawerlayout:drawerlayout:1.1.1和 Materialcom.google.android.material:material:1.0.0实现之后,我仍然收到错误。
我尝试添加其他实现,例如com.android.support:support-compat:28.0.0和com.android.support:design:25.0.0,但错误仍然存在,并且应用程序无法启动。
知道如何解决这个问题吗?
构建.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "edu.ktu.birthdaycalendar"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'org.jetbrains:annotations-java5:15.0'
implementation …Run Code Online (Sandbox Code Playgroud) 我在我的游戏控制台中收到以下错误,没有任何堆栈跟踪(在 android 7 和 10 上)。
Broadcast of Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000010 pkg=com.mycompany.myapp cmp=com.mycompany.myapp/com.google.firebase.iid.FirebaseInstanceIdReceiver (has extras) }
Run Code Online (Sandbox Code Playgroud)
使用的 Firebase 版本,
implementation 'com.google.firebase:firebase-iid:21.1.0'
implementation 'com.google.firebase:firebase-messaging:23.0.6'
Run Code Online (Sandbox Code Playgroud)
我不知道我的代码的哪一部分到底导致了这个错误,我发布了负责上传到FCM token我的服务器的代码。
我的Firebase消息服务,
@Override
public void onNewToken(@NonNull String s) {
super.onNewToken(s);
new TokenUploader().setFcmToken();//send to server
}
Run Code Online (Sandbox Code Playgroud)
TokenUploader类
//this function is called from MyFirebaseMessagingService and MainActivity
public void setFcmToken() {
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(task -> {
if (task.isSuccessful()) new Thread(() -> pushFcmToken(task.getResult())).start();
else if (task.getException() != null)
new Thread(() -> pushFcmToken(task.getException().getMessage())).start();
});
}
//push token to server
private …Run Code Online (Sandbox Code Playgroud) 如何用Java读取CSV文件?
我假设我需要使用输入流。输入流声明后如何继续?
InputStream file = item.getInputStream();
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Cordova 中开发自定义插件。问题是 Cordova 无法识别 JSON 文件。
我的json文件:
{
"name": "hello",
"version": "0.1.1",
"description": "show hello cordova",
"cordova": {
"id": "cordova-plugin-hello",
"platforms": []
},
"keywords": [
"ecosystem:cordova"
],
"author": "shubham",
"license": "ISC"
}
Run Code Online (Sandbox Code Playgroud)
我的 plugin.xml
<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova-plugin-hello" version="0.1.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android"><name>hello</name><js-module name="hello" src="www/hello.js"><clobbers target="cordova.plugins" /></js-module>
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助和您的时间。
我正在使用 Android 并在创建服务并从主活动线程运行它时遇到以下错误。我确实浏览了与此错误相关的所有线程,但他们看到的错误主要是针对 Activity 任务。以下是错误和代码的详细信息
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.serviceexample/com.example.serviceexample.MyServiceBg}; have you declared this activity in your AndroidManifest.xml?
Run Code Online (Sandbox Code Playgroud)
我确实检查了我的 AndriodManifest.xml,我确实看到了声明的服务
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.serviceexample">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="ServiceExample"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<service
android:name=".MyIntentService"
android:exported="false"></service>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".MyBgService"/>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
主活动.java:
package com.example.serviceexample;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) { …Run Code Online (Sandbox Code Playgroud) 我有一个Hashmap< String, String> p,我正在尝试用“-”替换键值的一半例如,假设我当前的哈希图具有以下值
"A", "100"
"B", "400"
"C", "600"
"D", "845"
Run Code Online (Sandbox Code Playgroud)
我想通过将值从提供的整数更改为“-”来以某种方式仅操作值键的一半(在本例中为前两个)。所以它看起来像这样:
"A", "-"
"B", "-"
"C", "600"
"D", "845"
Run Code Online (Sandbox Code Playgroud)
我已经尝试过这样做,但没有成功。
for (String i : p.keySet()/2) {
p.replace(i, '-')
}
Run Code Online (Sandbox Code Playgroud)
有没有办法做到这一点?如果是,您能解释一下如何吗?