小编Ani*_*har的帖子

未在 android studio 中显示项目文件夹结构

我有一个开源项目。

打开后,我没有找到项目文件夹和文件,在屏幕左侧:

在此处输入图片说明

我该怎么做才能显示项目文件夹结构?

android android-studio

3
推荐指数
1
解决办法
5559
查看次数

Android:VLC-android-sdk 将 60MB 增加到我的 apk 文件大小

我的 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)

android libvlc android-gradle-plugin

2
推荐指数
1
解决办法
1611
查看次数

如何在Flutter中将AppBar放在单独的文件中,同时仍显示小部件?

我目前正在开发一个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)

mobile android appbar dart flutter

2
推荐指数
5
解决办法
3928
查看次数

即使在 gradle 中添加依赖项后,“无法解析类 android.support.v4.widget.DrawerLayout”

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.0com.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 android-support-library drawerlayout androidx

2
推荐指数
1
解决办法
5979
查看次数

FirebaseInstanceIdReceiver 上出现 ANR

我在我的游戏控制台中收到以下错误,没有任何堆栈跟踪(在 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)

android firebase firebase-cloud-messaging

2
推荐指数
1
解决办法
2341
查看次数

用Java读取CSV文件

如何用Java读取CSV文件?

我假设我需要使用输入流。输入流声明后如何继续?

InputStream file = item.getInputStream();
Run Code Online (Sandbox Code Playgroud)

java csv

1
推荐指数
1
解决办法
5154
查看次数

CordovaError:插件无效!..\hello 需要一个有效的 package.json

我正在尝试在 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)

感谢您的帮助和您的时间。

plugins android cordova

1
推荐指数
1
解决办法
885
查看次数

对于服务类,我看到 android.content.ActivityNotFoundException: Unable to find explicit activity class

我正在使用 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)

java android activitynotfoundexception

0
推荐指数
1
解决办法
55
查看次数

是否可以仅迭代所提供的哈希映射条目的一半?

我有一个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)

有没有办法做到这一点?如果是,您能解释一下如何吗?

java iteration hashmap

0
推荐指数
1
解决办法
251
查看次数