麻烦与Android教程 [英] Trouble with Android tutorial

查看:190
本文介绍了麻烦与Android教程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得谁写的教程的人忘记了读书人他们是新的课题。我们应该了解那些通过步进的事情,但如果出现问题,我们不知道去哪里找的错误。

我的Windows 7专业版,我还没有尝试在此计算机上针对Android的Eclipse开发(虽然我使用Eclipse进行其他的东西)。我下载了Android教程刚才,与默认安装了它(我翻了一番,从2G的内存大小4G无论组件是打开的),并告诉它来启动它在安装后。 帮助/关于说,这是机器人工作室1.3.1。

我也跟着来创建一个新的项目,改变了几个文件,它显示的名字教程说明。当我尝试运行它,在AS窗口底部的日志文件中说:


  

错误检索父的项目:无资源发现匹配
  给定的名称'机器人:TextAppearance.Material.Widge.Button.Inverse


  
  

错误:(2)错误为检索项父:没有资源的发现,
  相匹配的名字。'机器人:Widget.Material.Button.Colored


在闲逛,我的种子了MyActivity.java文件是在红色下划线,并有在为R三个参考,也红了。如果我将鼠标悬停在任何一个,它说,它无法解析符号。

我还发现了一个名为V23 \\价值观v23.xml这有什么样子的一对夫妇的Andr​​oid组件的红色文字;其中之一是如下:


 <样式名称=Base.Widget.AppCompat.Button.Colored父=机器人:Widget.Material.Button.Colored/>


和'父'的值用红色下划线。由于这看起来像它指示错误的东西被称为父和我的运行时错误消息称父,似乎顺理成章他们的关系。

但我不知道从哪里里去。我依稀记得下载一个Android SDK中的指令,但认为被列入了Android工作室(想不通为什么它不会)。这就是所谓的机器人工作室SDK软件包,我想,包括需要的是什么。

其他等等主题的问题显然是太旧了,说要在菜单选项中单击不再存在,等等,或者说这样的话,打开文件的gradle,我无法找到一个,或可以肯定的你的目标项目版本设置为11,和我没有任何想法那是什么或在哪里可以找到它。

请更明确一些菜单使用,点击选项;记住这一点,虽然我是一个有经验的Java程序员,我没有用的IntelliJ,我已经没有编程在Android上,所以我不知道具体的东西要么环境的名称。


解决方案

丹尼尔·纽金特叫这个镜头:在左侧窗格的底部被称为摇篮脚本选项。我的第一个被命名的build.gradle(项目:MyFirstApp),和我的第二个的build.gradle(模块:应用程序)。双点击第二个,改变了compileSdkVersion 22到23 compileSdkVersion,然后试图重建它失败了。问题丹尼尔纽金特简称也提到确保我有版本的Andr​​oid M库,并点工具栏上的一个按钮启动SDK管理器;这表明,更新可用为Android 5.1(棒棒堂)。我无法弄清楚如何从窗口更新;我猜在点击该窗口中说:启动独立SDK管理器的链接(底部),并从那里更新(这花了很长的时间 - 15-20分钟)。

然后重建的摇篮,并成功运行应用程序(这或许花了一分钟或分半钟,时间比我预期)产生预期的窗口中选择一个设备等模拟器然后跑了你好,世界的应用程序应有的作用。

我要感谢所有谁回答,现在如果我可以弄清楚什么是错与调试驱动我的银河S5 ...

I think the people who write the tutorials forget that the people reading them are new to the topic. We're supposed to learn about those by stepping through things, but if something goes wrong we don't know where to look for the error.

I have Windows 7 Pro, I have not attempted any eclipse development for android on this machine (though I use eclipse for other things). I downloaded the Android tutorial just now, installed it with defaults (I doubled the memory size from 2G to 4G on whatever component that was) and told it to start up after it had installed. "Help / About" says it's "Android Studio 1.3.1".

I followed the tutorial instructions for creating a new project, changing the names of the couple of files where it indicated. When I attempt to run it, the log file at the bottom of the AS window says:

Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widge.Button.Inverse'.

Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

On poking around, I seed that the "MyActivity.java" file is underlined in red, and there are three references in it to "R", also red. If I hover over any one, it says it cannot resolve that symbol.

I also found a file named "v23\values-v23.xml" that has red text for what look like a couple of android components; one of them is the following:

<style name="Base.Widget.AppCompat.Button.Colored" parent="android:Widget.Material.Button.Colored"/>

and the value for 'parent' is underlined in red. Since this looks like it indicates an error with something called "parent" and my runtime error message says "parent", it seems logical they're related.

But I don't know where to go from there. I vaguely remember an instruction to download an Android SDK, but thought that was included with Android Studio (can't imagine why it wouldn't be). It was called the "Android Studio SDK Bundle", I figured that included what was needed.

Other SO questions on the subject are evidently too old, saying to click on menu options that no longer exist, etc., or say things like "open the gradle file" and I can't find one, or "be sure your target project version is set to 11", and I don't have any idea what that is or where to find it.

Please be explicit about menus to use and options to click on; remember that, though I'm an experienced Java programmer, I've not used IntelliJ and I've not programmed on Android, so I don't know the names of things specific to either environment.

解决方案

Daniel Nugent called this shot: at the bottom of the left-hand pane is an option called "Gradle Scripts". My first one was named build.gradle (Project: MyFirstApp), and my second build.gradle (Module: app). Double-clicked on the second one and changed "compileSdkVersion 22" to "compileSdkVersion 23", then attempted a rebuild which failed. The question Daniel Nugent referred to also mentions ensuring I have "Android M libraries" and points to a button on the Toolbar to start the SDK manager; that showed that an update "was available" for Android 5.1 (Lollipop). I couldn't figure out how to update from that window; I guessed at clicking on a link in that window (at the bottom) saying "Launch Standalone SDK Manager", and updated from there (which took a LONG time - 15-20 minutes).

Then the rebuild on Gradle succeeded and running the application (which took perhaps a minute or a minute and a half, longer than I expected) produced the expected window to pick a device, etc. The emulator then ran the "Hello, World" app as desired.

My thanks to all who responded; now if I can just figure out what's wrong with the debug driver for my Galaxy s5...

这篇关于麻烦与Android教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆