Tag: android studio

错误:Jack需要支持Java 8语言功能。 启用插件或删除sourceCompatibility JavaVersion.VERSION_1_8

正如在developer.android网站中所提到的 如果你的项目依赖于Jack,那么你应该迁移到使用Android Studio默认工具链中内置的Java 8支持。“Jack工具链已经被废弃了。 我需要使用lambda表达式,所以我已经禁用了插口选项,但是当我编译我的代码时,出现以下错误 Error:Jack is required to support Java 8 language features. Either enable Jack or remove sourceCompatibility JavaVersion.VERSION_1_8. 以下是我的build.gradle文件的截图

TextView在设计预览中显示,但不在实际的Android应用程序中显示

我在第二个Activity中有一个XML布局,根据用户是否登录来显示两个LinearLayouts的一个,而TextView我从来没有在应用中显示文本,但是当我看到布局编辑器中的“设计”面板 TextView在那里(如果我设置背景颜色,它显示颜色),但文本本身从不呈现。 单击MainActivity上的一个按钮将导致启动具有onCreate (它是Kotlin)的LoginActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.login_layout) 和布局: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:visibility="gone" android:id="@+id/loggedOut" android:padding="24dp"> <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/passName" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:focusable="true" android:hint="Username" android:inputType="textCapCharacters" /> </android.support.design.widget.TextInputLayout> <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/passPin" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:focusable="true" android:hint="PIN" android:inputType="numberPassword" /> </android.support.design.widget.TextInputLayout> <Button […]

Android数据绑定构建失败后,Gradle插件更新迁移到annotationProcessor

为了在我的Android Studio版本中支持即时运行,我需要将我的Gradle插件从版本2.2.3 升级到2.3.3 我知道我应该迁移到annoationProcessor ,我相信我已经正确地按照该指南 这样做后, Android DataBinding代码生成失败 先前链接的迁移指南指出,我需要的只是 确保你在Android Gradle 2.2插件或更新 从构建脚本中删除android-apt插件 将所有apt,androidTestApt和testApt依赖关系更改为新的格式 这应该是成功构建项目所需要的一切。 然而它并没有建立。 建立输出 Gradle版本在12s 481ms内完成了101个错误和23个警告 所有的错误都遵循相同的模式: C:\用户\ FooAdapter.java 错误:package com.example.app.databinding不存在 错误:找不到符号类ItemFooBinding 一个有趣的消息可以在构建控制台中找到: 警告:以下选项不被任何处理器识别:'[android.databinding.minApi,android.databinding.enableDebugLogs,android.databinding.sdkDir,android.databinding.bindingBuildFolder,android.databinding.enableForTests,android.databinding.modulePackage, android.databinding.generationTestVariant] [android.databinding.printTestVariant] [android.databinding.printTestVariant] [android.databinding.printTestVariant] 我想指出… 我认为我没有在一些XML文件 ,绑定表达式或命名问题的错误。 当我使用旧的gradle插件版本切换回Git分支(以及所有其他源文件是最新的)时,同一组源代码和XML构建, 我确实增加了这里所讨论的输出构建错误的限制,尽管现在看起来并不相关,因为你可以看到,我目前只有“101”错误。 🙂 附加信息 以下差异显示了我如何修改我的Gradle文件: build.gradle DiffChecker链接 app/build.gradle DiffChecker链接 此外,作为一个快速概述,这里是项目使用的一些“更有趣的”插件和库列表: 科特林 Android数据绑定 领域 改造 匕首 黄油刀(我知道…) Multidex支持库 有没有人有线索可能是什么问题? 任何帮助或想法将非常感谢!

如何在Android Studio 3.0 beta 5中创建一个Android项目?

测试版5发布。 我正在尝试像以前一样创建一个Android项目,但是它显示了一个类似于IDEA的窗口,我应该选择要使用“Java”,“Groovy”,“Gradle”等选项创建的项目类型。 ,“Kotlin”…哪里好喝“活动” – 模板? UPD 我在一台虚拟机上安装了Beta 5,它和我的真机一样使用了Xubuntu的版本。 一切运作良好。 也许这个问题与我以前安装JetBrains的Rider IDE有关。 但是,Rider已经安装了一段时间,并没有影响Studio以前测试版本的安装

查找Kotlin类的主构造函数的用法

想象一下,在你的基于Kotlin的项目中,你有一个超级重要和广泛使用的类。 它有唯一的定义如下的构造函数: class MyAwesomeManager(argOne: String, argTwo: String) 出于某种原因,您需要快速查找其构造函数的所有用法。 您正在使用Android Studio(或Intellj IDEA)。 但是…按Ctrl + LMB的名字会产生大量的垃圾结果 – 在导入,伴侣对象的字段调用等方面的使用。一个类的所有用途,但不是构造函数 。 将光标放在名称上并按Alt + F7也是一样 。 那么,我怎样才能找到这个主要构造函数的所有用途呢?

用Android Studio 3.0 Canary 4构建错误

我目前正在开发一个即时应用程序,为此我已经将我的单片应用程序重组为特征模块。 一切都在运行,直到Android Studio canary 3,但更新到Android Studio Canary 4后,我的项目无法生成以下错误: A problem was found with the configuration of task ':minimoBase:dataBindingExportBuildInfoDebugAndroidTest'. > Directory '/Users/nayak.vishal/projectData/minimo_instant_app_project/putica-client-android- native/minimoBase/build/intermediates/data-binding-info/androidTest/debug' specified for property 'xmlOutFolder' does not exist.

Kotlin anko onclick是未解决的参考

我是新的Kotlin和安科,我在android studio 3.0测试版6,Kotlin版本1.1.50和anko 0.10.1阶段错误错误:Kotlin anko onclick是未解决的参考

如何在活动类之外定义一个文本视图?

我有一个位置监听器对象,我想知道如何在活动类之外定义一个TextView。 在LayoutInflater.from(context).inflate(R.layout.main, null)我得到一个未解决的参考“上下文”和“主要”。 对于val locTextView = MainActivity.findViewById(R.id.locTextView) as TextView1我得到一个未解决的引用findViewById。 private val locationListener: LocationListener = object : LocationListener { override fun onLocationChanged(location: Location) { val v = LayoutInflater.from(context).inflate(R.layout.main, null) val locTextView = MainActivity.findViewById(R.id.locTextView) as TextView locTextView.setText("" + location.longitude + ":" + location.latitude); } override fun onStatusChanged(provider: String, status: Int, extras: Bundle) {} override fun onProviderEnabled(provider: String) […]

未找到Android Studio 3 appcompat资源

嗨,我有一个Android Studio 3(Beta-2)的问题 每当我创建新的/打开现有的项目,它显示我以下错误: 清理,重建,重新启动Studio,删除gradle文件不起作用。 在工作室2.3,一切都很好。 我的build.gradle文件: apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.2" dataBinding.enabled = true defaultConfig { applicationId "com.valentun.findgift" minSdkVersion 16 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) […]

在Android工作室Kotlin

我从kotlin使用,但是当我在我的项目中同步它,让我波纹管错误: Error:Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-3. Searched in the following locations: file:/D:/android-studio/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.2-3/kotlin-gradle-plugin-1.1.2-3.pom file:/D:/android-studio/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.2-3/kotlin-gradle-plugin-1.1.2-3.jar https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.2-3/kotlin-gradle-plugin-1.1.2-3.pom https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.2-3/kotlin-gradle-plugin-1.1.2-3.jar Required by: project : 这是我的build.gradle(Module) : apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { compileSdkVersion 25 buildToolsVersion "25.0.3" defaultConfig { applicationId "ir.baslam.kotlinme" minSdkVersion 16 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), […]