gpt4 book ai didi

java - 不幸的是,我的 android studio 应用程序在我的设备 Redmi 2 Prime 中停止了,但它在 Nexus 模拟器中运行

转载 作者:行者123 更新时间:2023-11-30 10:41:34 26 4
gpt4 key购买 nike

这是我的 list

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.agte.agtevivo">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Login" />
<activity android:name=".Register"></activity>
</application>

</manifest>

我还有 2 个 Activity :登录和注册,但没有与数据库连接。这只是一个链接。我从 android Marshmallow 开始,但在配置中更改为 Kitkat。我能做什么?

更新了有关资源的错误
  C:\Users\Admin\AndroidStudioProjects\AgteVivo\app\build\intermediates\res\merged\flavor\debug\values-ldltr-v21\values-ldltr-v21.xml

Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.
Error:Execution failed for task ':app:processFlavorDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Admin\AppData\Local\Android\Sdk\build-tools\24.0.0\aapt.exe'' finished with non-zero exit value 1

我的构建 gradle 文件
apply plugin: 'com.android.application'

android {
compileSdkVersion 19
buildToolsVersion '24.0.0'
defaultConfig {
applicationId "com.agte.agtevivo"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
flavor {
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
}

最佳答案

好的..您的问题有太多可能的解决方案

  • 检查您的 drawable/home即根布局的背景图像 - 解码位图时虚拟机内存不足。使图像尺寸更小。或编辑以减小图像大小..我个人建议使用paint.net并将图像调整为较低尺寸
  • 尝试使用不同分辨率的图像,例如 mdpi , hdpi , xhdpi如果只使用更高分辨率的图像,可能会导致低分辨率手机崩溃
  • 首先,在 XML 布局的父 View 上设置 id 属性:
       <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/RootView"

  • 然后,在 Activity 的 onDestroy() 方法中,调用 unbindDrawables()方法将引用传递给父 View ,然后执行 System.gc()
    @Override
    protected void onDestroy() {
    super.onDestroy();

    unbindDrawables(findViewById(R.id.RootView));
    System.gc();
    }

    private void unbindDrawables(View view) {
    if (view.getBackground() != null) {
    view.getBackground().setCallback(null);
    }
    if (view instanceof ViewGroup) {
    for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
    unbindDrawables(((ViewGroup) view).getChildAt(i));
    }
    ((ViewGroup) view).removeAllViews();
    }
    }

    这个 unbindDrawables()方法递归地探索 View 树并且:

    这些是我建议的一些解决方案。

    I personally suggest the first method..Try reducing the dimension of the images.

    希望这可以帮助

    关于java - 不幸的是,我的 android studio 应用程序在我的设备 Redmi 2 Prime 中停止了,但它在 Nexus 模拟器中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38452167/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com