android-studio 相关问题

用于解决有关使用Android Studio的问题,Android Studio是针对Android应用开发的Google官方IDE。一般情况下,请勿使用有关Android编程的问题;而是使用Android标签。

在Android Studio中删除logcat文件如何找到?

我可以使用什么程序或代码在 Android Studio 中自动保存 logcat 文件? 我正在做一个测试用例,并在 logcat 中记录控制台日志,当我发现一个错误时,我试图......

回答 1 投票 0

Flutter Module 是使用不兼容的 Kotlin 版本编译的。其元数据的二进制版本是1.8.0,预期版本是1.6.0

在 flutter 中 ** 模块是用不兼容的 Kotlin 版本编译的。其元数据的二进制版本是1.8.0,预期版本是1.6.0。** 格式化系统后安装并...

回答 2 投票 0

如何在android studio中导入库aar文件

aar 文件 我有一个项目,我想在其中包含一个以 aar 文件形式提供的库。您在图像中看到的是我需要将这些库导入到我的项目中。我寻找我...

回答 1 投票 0

无法在Android Studio中创建测试文件夹

我有一个项目,我在其中创建了 Java 和 Android 库。 在 Android 库中,创建了一个测试文件夹,如下所示: 但是,我想在主应用程序中添加测试...

回答 2 投票 0

Android Studio 无法识别方向类

r有一段时间,我已经习惯了这样一个事实:有时 IDE(Android Studio Koala 2024.1.1)会用红色标记导航方向,但会编译应用程序,运行良好。例子: 不是...

回答 1 投票 0

原因:错误 = 86,可执行 M1 Macbook (Android studio) 中的 CPU 类型错误

当尝试在 android studio 上运行模拟器时,我收到 Cause: error=86, Bad CPU type inexecutable 错误消息。我正在使用适用于 ARM 处理器的最新 android studio。

回答 3 投票 0

为什么我在 viewModel() 中遇到错误并且无法导入依赖项,因为它甚至不存在于 buil.gradle.kts 文件中

它显示了问题 它显示发生的错误 伙计们,我在导入 viewModel 时遇到此错误,然后当我在聊天 gpt 的帮助下签入 build.gradle.kts 文件时,依赖项...

回答 1 投票 0

为什么Android Studio模拟器屏幕出现然后消失,只出现在任务栏中?

当我运行模拟器时,它突然出现,然后消失并出现在工具栏中。当鼠标指针经过时,它仅出现在工具栏中,如附图所示。 我尝试删除...

回答 1 投票 0

为什么我在android studio的预览蓝图中看不到图像标志?

我的图像文件名logo.png位于项目文件夹es/drawable中。 [ xml代码: 我的图像文件名 logo.png 位于项目文件夹 es/drawable 中。 [ xml代码: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="center" android:background="@android:color/white" android:padding="16dp"> <ImageView android:id="@+id/logo.png" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/logo" android:contentDescription="@string/app_name"/> <TextView android:id="@+id/welcome_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/welcome_to_" android:textSize="24sp" android:textColor="@android:color/black" android:layout_marginTop="16dp" tools:ignore="HardcodedText" /> <!-- Optionally, add a button or other elements here --> </LinearLayout> 我在这一行中只尝试了徽标,然后是 logo.png android:id="@+id/logo.png" 但蓝图预览未显示徽标.png 在 ImageView 中试试这个 android:src="@drawable/logo.png"

回答 1 投票 0

Android Studio 两种运行单元测试方法的区别

当我右键单击包含单元测试的类(在文件夹 test 中,用 org.junit.Test 注释)时,我得到以下两个选项: 不幸的是,他们没有提供有关差异的更多信息......

回答 1 投票 0

Gradle 无法解析 Android Studio 中的依赖关系

每当我在 Android Studio 1.1 (OS X) 中从远程存储库 (jcenter) 添加依赖项时,我会在同步 Gradle 时收到以下错误: 错误:(26, 13) 无法解决: 每当我在 Android Studio 1.1 (OS X) 中从远程存储库 (jcenter) 添加依赖项时,我在同步 Gradle 时都会收到以下错误: Error:(26, 13) Failed to resolve: <packagename:version> 我的应用程序的build.gradle如下: 应用插件:'com.android.application' android { compileSdkVersion 21 buildToolsVersion "21.1.2" defaultConfig { applicationId "nl.timmevandermeer.cargoapp" minSdkVersion 19 targetSdkVersion 21 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:21.0.3' compile 'com.android.support:support-v4:21.0.3' compile 'com.google.android.gms:play-services:6.5.87' compile 'org.json:json:20141113' } 我尝试过更改存储库(jcenter()、mavenCentral() 等)、重新安装 Android Studio、JDK(7 和 8)、更改 Gradle 版本和 Android SDK 版本,但这些都不起作用。运行 ./gradlew build 后我得到: Could not resolve com.android.tools.build:gradle:1.1.0. 13:48:04.914 [ERROR] [org.gradle.BuildExceptionReporter] Required by: 13:48:04.915 [ERROR] [org.gradle.BuildExceptionReporter] :CargoApp:unspecified 13:48:04.932 [ERROR] [org.gradle.BuildExceptionReporter] > org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V 这也是我在其他情况下遇到的错误,例如当尝试使用 Intellij Idea 而不是 Android Studio 时。不过,在没有依赖项的情况下运行应用程序确实可以工作。 这里有类似的问题,当我选择“构建”->“清理项目”时 出现“对等方未经过身份验证”错误。 通过使用“http://jcenter.bintray.com/”而不是“https://jcenter.bintray.com/”来解决 repositories { jcenter({url "http://jcenter.bintray.com/"}) } 希望这对你有用。 我在 github 上的一个库上遇到了类似的问题,它指出将其安装为: dependencies { compile 'com.github.chrisbanes.photoview:library:1.2.4' } 此解决方法似乎有效,尽管它不是最理想的,因为它不会获取特定版本并导致 Android Studio 警告: dependencies { compile 'com.github.chrisbanes.photoview:library:+' } 就我而言,问题是我在 buildscript.repositories 中声明 jitpack,而不是在我的包 allprojects.repositories 中声明 build.gradle。 代替: buildscript { repositories { ... maven { url "https://jitpack.io" } } } 应该在这里: allprojects { repositories { ... maven { url "https://jitpack.io" } } } 当我在 build.gradle(模块级别)文件中添加此 com.droidninja:filepicker:2.2.5 依赖项时,我收到了此错误。 Failed to resolve: com.droidninja:filepicker:2.2.5 然后我添加了gradlePluginPortal() 和 settings.gradle 中的 'maven { url 'https://jitpack.io' }' kts dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() // Add these lines if they are not there. mavenCentral() maven { setUrl ("https://jitpack.io") } } } 格罗维 dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() // Add this line gradlePluginPortal() // If issue still persist then try to add this line maven { url 'https://jitpack.io' } } } 这对我有用。 相当晚,但可能你的 gradle 在离线模式下工作。 转到文件->设置->Gradle 并取消选中离线模式。 然后尝试刷新 gradle 应该可以工作 我位于公司防火墙后面。 我设置了 http 设置,但没有设置 https 设置。 因此,我将以下内容添加到我的 gradle.properties 文件中: systemProp.https.proxyPassword=... systemProp.https.proxyHost=... systemProp.https.nonProxyHosts=... systemProp.https.proxyUser=... systemProp.https.proxyPort=... 顶部build.gradle: buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.1.3' } } 应用程序build.gradle: apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "nl.timmevandermeer.cargoapp" minSdkVersion 19 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { // compile fileTree(dir: 'libs', include: ['*.jar']) // <-- use gradle depedencies compile 'com.android.support:appcompat-v7:22.0.0' // <-- brings in v4 // compile 'com.google.android.gms:play-services:7.0.0' // <-- will cause MultiDex exception, you need to choose which ones you want // compile 'org.json:json:20141113' // <-- android comes with org.json } 多去中心化问题: compile 'com.google.android.gms:play-services:7.0.0'太大,不宜直接使用。请在此处选择您想要的模块:http://developer.android.com/google/play-services/setup.html 我有类似的问题 -> 错误:无法解决: 通过使用 maven { url 'https://jitpack.io' } 代替 maven {url 'https://maven.google.com/'} 我已将其添加到项目级别的 build.gradle 中 allprojects { repositories { maven { url 'https://jitpack.io' } } } 效果很好。 在 UBUNTU - 14.04 中测试, >delete .androidstudio1.2 , .gradle , .android , Android studio project from home directory > Launch using studio.sh >close the dialogue letting you choose new or old setting , just close it using that "x " button > then it will set up an virtual nexus 5 >then there will be two errors saying problem about "sdk" and "gradle " > Caution : choose the appropriate sdk version by clicking on the link given by where the problem is shown . > close android studio > reopen android studio > then you will be thrown a possible error with jdk not found . >go to file -> project structure > give the path to jdk , in my case its "usr/local/java/jdk..." >close android studio and open again , the gradle might work well after this . 就我而言,我将其添加到我的 build.gradle (module:app): compile 'com.github.glomadrian:velocimeterlibrary:1.1@aar' 然而,今天却给了我一个错误。我的解决方案是改用这个: compile 'com.github.glomadrian:velocimeterlibrary:+'

回答 10 投票 0

Android Studio - 在按钮回调中设置 ImageView 的可见性不起作用

首先 - 我对应用程序编码、kotlin、xml 等非常陌生(上周开始自学)。 话虽如此:我正在尝试编写一个显示图像的活动,并且用户需要 p...

回答 1 投票 0

自 Android studio 3.5 起,辅助服务在每次运行时都会自动关闭

自从我将 Android Studio 更新到 3.5 以来,当我启动 Run 来构建和部署我的应用程序时,我的自定义辅助功能服务会自动关闭(不是崩溃,只是在设置中关闭)。 钙...

回答 4 投票 0

Android Studio 设备列表中无法识别手机

我今天删除了android studio 4.1.3并安装了android studio Koala。我以前可以通过 USB 进行调试。使用新的考拉版本我还没有成功。 我的设备何时显示

回答 1 投票 0

如何在 Android Jetpack Compose 中保存和恢复 WebView 状态?

我之前通过重写 Activity 类中的 onSaveInstanceState(outState: Bundle) 方法在 Android 应用程序中保存 WebView 状态,如下所示: 覆盖 fun onSaveInstanceState(

回答 1 投票 0

android studio 中的IOS?

我在android studio中有一个现成的项目,我想知道我是否可以为ios系统构建相同的应用程序?示例如果这是不可能的,请建议最好的方法来做到这一点以及什么

回答 2 投票 0

在Android Studio中找不到创建包菜单

我在 Android Studio 的风味文件夹之一下添加包时遇到了麻烦:右键单击 java 文件夹后,我看不到“Package”或“Java Classes”选项! 我做到了

回答 6 投票 0

android studio 模拟器中的无限启动错误

“正在启动”状态后,模拟器停止在“正在启动...”状态。在此期间,模拟设备的屏幕始终为黑屏。有趣的是,这种行为只有andro上才有……

回答 1 投票 0

如何在我的可穿戴应用程序的 xml 文件中添加滚动视图?

这是我的 xml 代码的一部分,我的问题是我应该进行哪些更改来添加滚动视图。我希望能够向下滚动活动。那么我是否要更改循环进度布局的布局...

回答 1 投票 0

科特林 || Room DB:计算数据库实时数据时出现异常

我有这个带有 Room DB 和 API 的应用程序。 API 中的一些常用数据与每个用户的会话一起存储在 Room DB 中 但在这里,尽管清除了缓存,但我还是遇到了这个异常...

回答 1 投票 0

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