android开发,eclipse中的AndroidManifest.xml

在AndroidManifest.xml中我写了
android:name="android.test.InstrumentationTestRunner"
android:targetpackage="com.sqlite.activity"
android:label="Test My App"
/>

提示错误
error: No resource identifier found for attribute 'targetpackage' in package 'android'

suannai0314
鹳狸媛 楼主的这个问题解决了么?下边的答案能解决问题么?如果可以麻烦点击答案旁的√采纳哦~如果没有也可以将自己的答案贴上然后进行采纳的。
大约 6 年之前 回复

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Android DatePicker显示异常
《Android权威编程》里面的一道例题 我创建了dialog_date的xml文件,以DatePicker为根元素,以下是代码 <?xml version="1.0" encoding="utf-8"?> <DatePicker xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/dialog_date_datePicker" android:layout_width="wrap_content" android:layout_height="wrap_content" android:calendarViewShown="false" /> 在视图布局里无法显示,出现了以下的错误 android.content.res.Resources$NotFoundException Exception details are logged in Window > Show View > Error Log 打开Error Log android.content.res.Resources$NotFoundException at com.android.layoutlib.bridge.android.BridgeContext.obtainStyledAttributes(BridgeContext.java:490) at com.android.layoutlib.bridge.android.BridgeContext.obtainStyledAttributes(BridgeContext.java:93) at android.widget.TextView.setTextAppearance(TextView.java:2484) at android.widget.YearPickerView$YearAdapter.getView(YearPickerView.java:132) at android.widget.AbsListView.obtainView(AbsListView.java:2344) at android.widget.ListView.measureHeightOfChildren(ListView.java:1270) at android.widget.ListView.onMeasure(ListView.java:1182) at android.view.View.measure(View.java:17430) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463) at android.widget.FrameLayout.onMeasure(FrameLayout.java:430) at android.view.View.measure(View.java:17430) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436) at android.widget.LinearLayout.measureVertical(LinearLayout.java:722) at android.widget.LinearLayout.onMeasure(LinearLayout.java:613) at android.view.View.measure(View.java:17430) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463) at android.widget.FrameLayout.onMeasure(FrameLayout.java:430) at android.view.View.measure(View.java:17430) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463) at android.widget.FrameLayout.onMeasure(FrameLayout.java:430) at android.view.View.measure(View.java:17430) at android.widget.LinearLayout.measureVertical(LinearLayout.java:875) at android.widget.LinearLayout.onMeasure(LinearLayout.java:613) at android.view.View.measure(View.java:17430) at android.widget.LinearLayout.measureVertical(LinearLayout.java:875) at android.widget.LinearLayout.onMeasure(LinearLayout.java:613) at android.view.View.measure(View.java:17430) at com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView(RenderSessionImpl.java:626) at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:526) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:334) at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:349) at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:519) at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1584) at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1309) at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:1066) at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegatePageChange(LayoutEditorDelegate.java:686) at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.pageChange(CommonXmlEditor.java:360) at org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiPageEditorPart.java:1102) at org.eclipse.ui.forms.editor.FormEditor.setActivePage(FormEditor.java:607) at com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor.selectDefaultPage(AndroidXmlEditor.java:450) at com.android.ide.eclipse.adt.internal.editors.AndroidXmlEditor.addPages(AndroidXmlEditor.java:311) at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.addPages(CommonXmlEditor.java:285) at org.eclipse.ui.forms.editor.FormEditor.createPages(FormEditor.java:138) at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:363) at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:151) at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPartControl(CompatibilityEditor.java:99) at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:341) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:898) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:879) at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:121) at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:345) at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:264) at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:104) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:73) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:55) at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:129) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:971) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:640) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:746) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java:717) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:711) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:695) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.createElement(PartServiceImpl.java:1209) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1170) at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:400) at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:289) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3186) at org.eclipse.ui.internal.WorkbenchPage.access$25(WorkbenchPage.java:3149) at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:3131) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3126) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3090) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3080) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:541) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:500) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:360) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:167) at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:268) at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:233) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:376) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$4.open(PackageExplorerPart.java:538) at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48) at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:854) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173) at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:851) at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1168) at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1275) at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:278) at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:272) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:313) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:654) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608) at org.eclipse.equinox.launcher.Main.run(Main.java:1515) ** 根本看不懂在说什么,有谁能帮忙解答下吗? **以下是我的AndroidManifest的xml文件 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.bignerdranch.android.criminalintent" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".CrimeListActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".CrimePagerActivity" android:label="@string/app_name" > </activity> </application> </manifest>
android报错Could not determine the class-path ...
Android Studio导入Eclipse项目报错: `Error:Could not determine the class-path for interface com.android.builder.model.AndroidProject.` 项目的build.gradle文件如下: ```Gradle buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.0' } } apply plugin: 'com.android.application' dependencies { compile fileTree(dir: 'libs', include: '*.jar') } android { compileSdkVersion 22 buildToolsVersion "25.0.2" sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/<type> // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } } ``` 请问一下该怎么解决?
android4.2版本的开发时看不懂MainActivity中代码的含义
新版android eclipse中的MainActivity.java里面增加了好多新的代码,因为还是菜鸟一只,好多代码都不知道是什么作用,求大神指教。之前就一直把代码敲错位置了,耽误了好久,后来总算知道错在哪里了,为了错误不再重犯,求教大神解释整个默认的代码片段大致是什么含义。` enter code here package com.example.helloworld; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } } `
Eclipse for android 创建新工程出现@drawable错误
[2016-11-06 11:18:11 - Activity] C:\Users\宁胖胖\workspace2\Activity\AndroidManifest.xml:11: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/ic_launcher'). [2016-11-06 11:18:11 - Activity] [2016-11-06 11:18:13 - Activity] C:\Users\宁胖胖\workspace2\Activity\AndroidManifest.xml:11: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/ic_launcher'). [2016-11-06 11:18:13 - Activity] [2016-11-06 11:18:14 - Activity] C:\Users\宁胖胖\workspace2\Activity\AndroidManifest.xml:11: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/ic_launcher'). [2016-11-06 11:18:14 - Activity] 系统日志如上,想问下是缺少了什么文件吗,困扰好几天了,求解谢谢
android studio 打包无法更新eclipse打包程序
之前一直用32位xp系统,eclipse编译android 程序,最近迁移到android studio 并且换了64位window7系统。发现android studio 无法自动更新之前eclipse打包的程序。提示存在已存在签名冲突的数据包,无法安装。 有没有大神碰到此问题的。怎么让顺利更新啊。因为eclipse编译的程序已经上线,涉及大量的客户端,不可能全部卸载重装了。 ps:签名都是一样的。并且Androidmanifest.xml文件的 android:minSdkVersion="14" android:targetSdkVersion="19" 都是一样的。
第一个安卓程序,eclipse不识别语句怎么办
![图片说明](https://img-ask.csdn.net/upload/201501/13/1421128441_709484.jpg) ```按照书上写的修改strings.xml fist_layout.xml 和Androidmanifest.xml后还是不能运行,好像一个包不能识别,按照书上装了android2.2,新手第一次发帖,求解答 ``` ``` ``` ``` ```
初学者eclipse安卓 manifest中报andriod属性未绑定
学习《第一行代码》 然后看书之后自己试一遍就报错....求指点 com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for F:\AndriodTest\ActivityTest\AndroidManifest.xml: 与元素类型 "activity" 相关联的属性 "andriod:name" 的前缀 "andriod" 未绑定。 - ActivityTest] Error in an XML file: aborting build. ``` <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.activitytest" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="L" android:targetSdkVersion="21" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity andriod:name="com.example.activitytest.FirstActivity" andriod:label="This is"> <intent-filter> <action andriod:name="android.intent.action.MAIN" /> <category andriod:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> ```
关于命令行创建一个android test-project
在适应IDE(例如Eclipse)创建Android test project时可以将test target project设置为this project,那么如何在命令行创建一个android test project ? 如果使用 android create test-project -p . -m . 会报错:Error: No AndroidManifest.xml file found in the main project directory: 如何解决? 我做的是Robotium测试,只有Apk木有源代码,所以被测试工程师不存在滴。肿么办?
安卓菜鸟 这两个按钮加入同一个页面,加入第二个按钮之后运行时只有第二个按钮可点击 第一个按钮点击没反应,求问是怎么回事?
package com.example.liuyuteng; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class SecondActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.two); Button button2=(Button)findViewById(R.id.button2); button2.setOnClickListener(new OnClickListener(){ public void onClick(View v){ Intent intent=new Intent(SecondActivity.this,ThreeActivity.class); startActivity(intent); } }); super.onCreate(savedInstanceState); setContentView(R.layout.two); Button button3=(Button)findViewById(R.id.button3); button3.setOnClickListener(new OnClickListener(){ public void onClick(View v){ Intent intent=new Intent(SecondActivity.this,FourActivity.class); startActivity(intent); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
看书打的第一个andriod程序可是有错,不太懂,求大神指教
package com.test.helloworld; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class HelloWorldActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.hello_world_layout); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.hello_world, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } 以下是错误信息 [2016-09-19 21:10:32 - HelloWord] D:\eclipse\HelloWord\AndroidManifest.xml:11: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/ic_launcher'). 纠结了很长时间了,哈哈哈哈求大神解答
Android开发连接本地Mongodb出现deprecated提示
开发环境是Eclipse+Android SDK+Mongodb+mongo-java-driver Android的API是8(2.2),最低支持的是1.5,最高支持的是4.4。 Mongodb是用2.6.6 mongo-java-driver是2.13.0-rc2 我是做一个简单的学生资料录入的app。 原理是通过点击 save的button,触发SaveButton_Click,然后SaveButton_Click会把对应的 EditText的内容转换成一个mongodb的文档写入数据库。 编码提示mongo的构造方法已经deprecated, new Mongo(); new Mongo("localhost"); new Mongo("localhost", 27017); new Mongo(new ServerAddress("localhost")); 上述4种debug软件会有提示,在模拟器运行也会报错。如何才能解决呢? MainActivity.java的代码: package com.example.testing; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.*; import com.mongodb.*; public class MainActivity extends ActionBarActivity { Button button; int count=0; String studentname; String studentnum; String studentage; String studentsexual; Mongo conn; DB db; DBCollection coll; BasicDBObject doc; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button)findViewById(R.id.saveButton); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @SuppressWarnings("deprecation") public void SaveButton_Click(View view) { try{ conn = new Mongo("localhost"); }catch (Exception e){ throw new RuntimeException(e); }; DB db = conn.getDB("grade"); DBCollection coll = db.getCollection("Student"); BasicDBObject doc = new BasicDBObject(); doc.put("name", R.id.nameEditText); doc.put("num",R.id.nameEditText); doc.put("age",R.id.ageEditText); doc.put("sexual",R.id.sexualEditText); coll.setWriteConcern(WriteConcern.SAFE); } }
初学者eclipse报错:not well-formed (invalid token)
新建有两个Activity用于两个Activity之间简单的切换,java文件跟xml文件都没问题了,就是在Androidmanifest中声明使用IntentTestActivity和AnotherActivity出问题 代码如下: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.intenttest" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".IntentTestActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".AnotherActivity" <intent-filter>//这里报错,Error parsing XML:not well-formed (invalid token) <action android:name="android.guo.action.anotheractivity" /> </intent-filter> </activity> </application> </manifest>
【大神求组】eclipse项目导入Androidstudio报错
![图片说明](https://img-ask.csdn.net/upload/201606/13/1465795548_265211.png) 我用的Androidstudio版本是2.1.2,导入eclipse项目之后出现在图片中的问题。 Event Log里面显示的是: 12:50:06 Executing tasks: [clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources] 12:50:13 Gradle build finished with 1 error(s) in 6s 549ms 下面是导入后生成的IMPORT SUMMARY: ``` ECLIPSE ANDROID PROJECT IMPORT SUMMARY ====================================== Ignored Files: -------------- The following files were *not* copied into the new Gradle project; you should evaluate whether these are still needed in your project and if so manually move them: * ic_launcher-web.png * proguard-project.txt Replaced Jars with Dependencies: -------------------------------- The importer recognized the following .jar files as third party libraries and replaced them with Gradle dependencies instead. This has the advantage that more explicit version information is known, and the libraries can be updated automatically. However, it is possible that the .jar file in your project was of an older version than the dependency we picked, which could render the project not compileable. You can disable the jar replacement in the import wizard and try again: android-support-v4.jar => com.android.support:support-v4:18.0.0 gson-2.2.4.jar => com.google.code.gson:gson:2.2.4 Potentially Missing Dependency: ------------------------------- When we replaced the following .jar files with a Gradle dependency, we inferred the dependency version number from the filename. This specific version may not actually be available from the repository. If you get a build error stating that the dependency is missing, edit the version number to for example "+" to pick up the latest version instead. (This may require you to update your code if the library APIs have changed.) gson-2.2.4.jar => version 2.2.4 in com.google.code.gson:gson:2.2.4 Moved Files: ------------ Android Gradle projects use a different directory structure than ADT Eclipse projects. Here's how the projects were restructured: * AndroidManifest.xml => app\src\main\AndroidManifest.xml * assets\ => app\src\main\assets * libs\fastjson-1.2.2.jar => app\libs\fastjson-1.2.2.jar * res\ => app\src\main\res\ * src\ => app\src\main\java\ Next Steps: ----------- You can now build the project. The Gradle project needs network connectivity to download dependencies. Bugs: ----- If for some reason your project does not build, and you determine that it is due to a bug or limitation of the Eclipse to Gradle importer, please file a bug at http://b.android.com with category Component-Tools. (This import summary is for your information only, and can be deleted after import once you are satisfied with the results.) ```
在模拟器运行的时候出错,提示Unfortunately,XXX has stopped
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.textqrcode" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.VIBRATE"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:configChanges="orientation|keyboardHidden" android:name="com.zxing.activity.CaptureActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden" > </activity> </application> </manifest> ``` ``` 01-31 07:52:24.090: E/AndroidRuntime(695): FATAL EXCEPTION: main 01-31 07:52:24.090: E/AndroidRuntime(695): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.textqrcode/com.example.textqrcode.CaptureActivity}; have you declared this activity in your AndroidManifest.xml? 01-31 07:52:24.090: E/AndroidRuntime(695): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508) 01-31 07:52:24.090: E/AndroidRuntime(695): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384) 01-31 07:52:24.090: E/AndroidRuntime(695): at android.app.Activity.startActivityForResult(Activity.java:3190) 01-31 07:52:24.090: E/AndroidRuntime(695): at android.app.Activity.startActivity(Activity.java:3297) 01-31 07:52:24.090: E/AndroidRuntime(695): at com.example.textqrcode.MainActivity$1.onClick(MainActivity.java:26) 01-31 07:52:24.090: E/AndroidRuntime(695): at android.view.View.performClick(View.java:3480) 01-31 07:52:24.090: E/AndroidRuntime(695): at android.view.View$PerformClick.run(View.java:13983) 01-31 07:52:24.090: E/AndroidRuntime(695): at android.os.Handler.handleCallback(Handler.java:605) 01-31 07:52:24.090: E/AndroidRuntime(695): at android.os.Handler.dispatchMessage(Handler.java:92) 01-31 07:52:24.090: E/AndroidRuntime(695): at android.os.Looper.loop(Looper.java:137) 01-31 07:52:24.090: E/AndroidRuntime(695): at android.app.ActivityThread.main(ActivityThread.java:4340) 01-31 07:52:24.090: E/AndroidRuntime(695): at java.lang.reflect.Method.invokeNative(Native Method) 01-31 07:52:24.090: E/AndroidRuntime(695): at java.lang.reflect.Method.invoke(Method.java:511) 01-31 07:52:24.090: E/AndroidRuntime(695): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 01-31 07:52:24.090: E/AndroidRuntime(695): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 01-31 07:52:24.090: E/AndroidRuntime(695): at dalvik.system.NativeStart.main(Native Method)
如何检测布局中的错误?
如何检测布局错误?我启动 eclipse,并且用布局打开第一个activity,但是第一个Activity.java 文件在 SetContentView(R.layout.main) 这儿有错误。我用的是 Sdk API 16。 package com.eConnect.Restaurant; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class LoginActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } } main.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/LinearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#000000" android:orientation="vertical" > <ImageView android:id="@+id/imageView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="15dip" android:contentDescription="@string/desc" android:src="@drawable/econnect_logo" /> <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="15dip" android:text="@string/uid" android:textAppearance="?android:attr/textAppearanceLarge" /> <EditText android:id="@+id/editText1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="15dip" android:background="#ffffff" android:hint="@string/uid" android:inputType="number" android:textColor="#9966cc" > <requestFocus /> </EditText> <TextView android:id="@+id/textView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="15dip" android:text="@string/PW" android:textAppearance="?android:attr/textAppearanceLarge" /> <EditText android:id="@+id/editText2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="15dip" android:background="#ffffff" android:hint="@string/PW" android:inputType="numberPassword" android:textColor="#9966cc" /> <TextView android:id="@+id/textView3" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="15dip" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#ff0000" android:textStyle="bold" /> <Button android:id="@+id/button1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="15dip" android:background="#cccccc" android:text="@string/bt" android:textColor="#006600" android:textStyle="bold" /> androidmanifest.xml: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.eConnect.Restaurant" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".LoginActivity" android:label="@string/title_activity_login" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
各位高手,帮我分析以下代码在安卓手机上运行时报错的原因!
//MainActivity.java如下: ```import android.app.Activity; import android.os.Bundle; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.webkit.WebSettings.RenderPriority; import android.webkit.WebView; import android.webkit.WebViewClient; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView browser=(WebView)findViewById(R.id.Toweb); browser.loadUrl("http://58.215.195.18:10010/login_person.jsp"); //在此app不能上网提示“Proxy_Error",但UC浏览器和电脑都能上 browser.getSettings().setSupportZoom(true); browser.getSettings().setBuiltInZoomControls(true); browser.getSettings().setJavaScriptEnabled(true); browser.getSettings().setDomStorageEnabled(true); browser.getSettings().setBlockNetworkImage(true); browser.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); browser.getSettings().setAllowFileAccess(true); browser.getSettings().setAppCacheEnabled(true); browser.getSettings().setSaveFormData(false); browser.getSettings().setLoadsImagesAutomatically(true); browser.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { WebView browser=(WebView)findViewById(R.id.Toweb); // Check if the key event was the Back button and if there's history if ((keyCode == KeyEvent.KEYCODE_BACK) && browser.canGoBack()) { browser.goBack(); return true; } return super.onKeyDown(keyCode, event); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } ``` //activity_main.xml如下: ```<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.wuxireservedfunds.MainActivity" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <WebView android:id="@+id/Toweb" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </RelativeLayout>``` //AndroidManifest.xml如下: ```<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.wuxireservedfunds" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" /> <uses-permission android:name="android.permission.INTERNET"> </uses-permission> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> ``` 在eclipse中编译时并没有错误提示,是apk在模拟器和手机运行时报错误,具体如下: Proxy Error The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /login_person.jsp. Reason:Error reading from remote server 但是网址:http://58.215.195.18:10010/login_person.jsp却能在手机的uc浏览器 和电脑上正常打开,真是百思不得其解!高手们,出马啊!拜托了!
在布局中怎么使用自定义的视图
这个我创建的视图类: public final class MyView extends View { public MyView(Context context, AttributeSet attrs) { super(context, attrs); [...] } [...] } 然后我想把这个视图放在layout.xml中使用: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <com.hitziger.barcode.MyView android:id="@+id/my_view" android:layout_width="fill_parent" android:layout_height="fill_parent"/> </FrameLayout> 但是Eclipse报出了log的错误: AndroidManifest: Ignoring unknown 'com.hitziger.barcode.MyView' XML element 在布局中怎么使用自定义的视图?
android 源码编译出现的错误
xxxxx@compiler:~/xxxx/0313-test-1/0313/packages/xxxx/myTV$ mm -B ============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=4.4.2 TARGET_PRODUCT=m201 TARGET_BUILD_VARIANT=user TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=arm TARGET_ARCH_VARIANT=armv7-a-neon TARGET_CPU_VARIANT=cortex-a9 HOST_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-3.2.0-86-generic-x86_64-with-Ubuntu-12.04-precise HOST_BUILD_TYPE=release BUILD_ID=KOT49H OUT_DIR=out ============================================ PRODUCT_COPY_FILES device/xxxx/m201/audio_effects.conf:system/etc/audio_effects.conf ignored. PRODUCT_COPY_FILES device/xxxx/m201/lowmemorykiller.txt:/system/etc/lowmemorykiller.txt ignored. PRODUCT_COPY_FILES device/xxxx/m201/lowmemorykiller_512M.txt:/system/etc/lowmemorykiller_512M.txt ignored. No private recovery resources for TARGET_DEVICE m201 make: Entering directory `/mnt/commondata/user/aliontuo/xxxx/0313-test-1/0313' target R.java/Manifest.java: myTV (out/target/common/obj/APPS/myTV_intermediates/src/R.stamp) Warning: AndroidManifest.xml already defines versionCode (in http://schemas.android.com/apk/res/android); using existing value in manifest. Warning: AndroidManifest.xml already defines versionName (in http://schemas.android.com/apk/res/android); using existing value in manifest. Warning: AndroidManifest.xml already defines minSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest. Warning: AndroidManifest.xml already defines targetSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest. target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libgson-2.2.4_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libgson-2.2.4_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libotaupdate_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libotaupdate_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-broker-5.12.0_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-broker-5.12.0_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-client-5.12.0_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-client-5.12.0_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-console-5.12.0_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-console-5.12.0_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-jaas-5.12.0_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-jaas-5.12.0_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-kahadb-store-5.12.0_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-kahadb-store-5.12.0_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-openwire-legacy-5.12.0_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-openwire-legacy-5.12.0_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-protobuf-1.1_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-protobuf-1.1_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-spring-5.12.0_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-spring-5.12.0_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-web-5.12.0_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libactivemq-web-5.12.0_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libgeronimo-j2ee-management_1.1_spec-1.0.1_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libgeronimo-j2ee-management_1.1_spec-1.0.1_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libgeronimo-jms_1.1_spec-1.1.1_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libgeronimo-jms_1.1_spec-1.1.1_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libgeronimo-jta_1.0.1B_spec-1.0.1_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libgeronimo-jta_1.0.1B_spec-1.0.1_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libhawtbuf-1.11_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libhawtbuf-1.11_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libjcl-over-slf4j-1.7.10_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libjcl-over-slf4j-1.7.10_intermediates/javalib.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libslf4j-api-1.7.10_intermediates/classes.jar) target Prebuilt: myTV (out/target/common/obj/JAVA_LIBRARIES/libslf4j-api-1.7.10_intermediates/javalib.jar) target Java: myTV (out/target/common/obj/APPS/myTV_intermediates/classes) Note: packages/amlogic/myTV/src/com/justek/mytv/entity/FileSelector.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Copying: out/target/common/obj/APPS/myTV_intermediates/classes-jarjar.jar Copying: out/target/common/obj/APPS/myTV_intermediates/emma_out/lib/classes-jarjar.jar Copying: out/target/common/obj/APPS/myTV_intermediates/classes.jar Copying: out/target/common/obj/APPS/myTV_intermediates/noproguard.classes.jar target Dex: myTV trouble processing "javax/transaction/Transaction.class": Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library. This is often due to inadvertently including a core library file in your application's project, when using an IDE (such as Eclipse). If you are sure you're not intentionally defining a core class, then this is the most likely explanation of what's going on. However, you might actually be trying to define a class in a core namespace, the source of which you may have taken, for example, from a non-Android virtual machine project. This will most assuredly not work. At a minimum, it jeopardizes the compatibility of your app with future versions of the platform. It is also often of questionable legality. If you really intend to build a core library -- which is only appropriate as part of creating a full virtual machine distribution, as opposed to compiling an application -- then use the "--core-library" option to suppress this error message. If you go ahead and use "--core-library" but are in fact building an application, then be forewarned that your application will still fail to build or run, at some point. Please be prepared for angry customers who find, for example, that your application ceases to function once they upgrade their operating system. You will be to blame for this problem. If you are legitimately using some code that happens to be in a core package, then the easiest safe alternative you have is to repackage that code. That is, move the classes in question into your own package namespace. This means that they will never be in conflict with core system classes. JarJar is a tool that may help you in this endeavor. If you find that you cannot do this, then that is an indication that the path you are on will ultimately lead to pain, suffering, grief, and lamentation. 1 error; aborting make: *** [out/target/common/obj/APPS/myTV_intermediates/classes-with-local.dex] Error 1 make: Leaving directory `/mnt/commondata/user/aliontuo/xxxx/0313-test-1/0313' 这个是因为我引入的jar包的什么原因导致的,是否这些包有冲突? 求大神帮忙看看啊
Activity跳转失败,点击跳转按钮后黑屏卡住
Activity跳转失败,点击跳转按钮后黑屏卡住,估计是otheractivity启动失败,android 小白 activity_other.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" > <TextView android:layout_width="fill_parent" android:layout_height="35dp" android:text="@string/activity_other_headtext" android:gravity="center" android:background="#E0E0E0" /> <TextView android:layout_width="fill_parent" android:layout_height="35dp" android:text="@string/activity_other_meg" android:gravity="center"/> <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content"> <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="160dp" android:layout_height="wrap_content" android:gravity="right" android:padding="5dp" android:text="@string/activity_other_username" /> <TextView android:id="@+id/activity_other_username" android:layout_width="160dp" android:layout_height="wrap_content" android:padding="5dp"/> </TableRow> <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" android:text="@string/activity_other_sex" android:padding="5dp"/> <TextView android:layout_width="160dp" android:layout_height="wrap_content" android:padding="5dp" android:id="@+id/activity_other_sex" android:text="@string/activity_other_null"/> </TableRow> <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" android:text="@string/activity_other_phonenum" android:padding="5dp"/> <TextView android:layout_width="160dp" android:layout_height="wrap_content" android:padding="5dp" android:id="@+id/activity_other_phonenum" android:text="@string/activity_other_null"/> </TableRow> <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" android:text="@string/activity_other_QQ" android:padding="5dp"/> <TextView android:layout_width="160dp" android:layout_height="wrap_content" android:padding="5dp" android:id="@+id/activity_other_QQ" android:text="@string/activity_other_null"/> </TableRow> </TableLayout> <Button android:id="@+id/activity_other_Button" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/activity_other_know_button"> </Button> </LinearLayout> ``` Mainactivity.java ``` package com.example.p105092015050; import java.security.PublicKey; import android.R.string; import android.app.Activity; import android.content.Intent; import android.inputmethodservice.Keyboard.Key; import android.os.Bundle; import android.os.storage.OnObbStateChangeListener; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.RadioGroup.OnCheckedChangeListener; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity { private EditText username_EText=null; private EditText phonenum_EText=null; private EditText QQ_EText=null; private EditText passwd_EText=null; private EditText passwd_EText_reptition=null; private CheckBox checkBox=null; private Button regist_button=null; private RadioGroup sex_radiogroup=null; public char sex; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); } public void init() { username_EText=(EditText)findViewById(R.id.activity_main_EText_username); sex_radiogroup=(RadioGroup)findViewById(R.id.radiogroup); phonenum_EText=(EditText)findViewById(R.id.activity_main_EText_phonenum); QQ_EText=(EditText)findViewById(R.id.activity_main_EText_QQ); passwd_EText=(EditText)findViewById(R.id.activity_main_EText_password); passwd_EText_reptition=(EditText)findViewById(R.id.activity_main_EText_password_reptition); checkBox=(CheckBox)findViewById(R.id.activity_main_CheckBox); regist_button=(Button)findViewById(R.id.activity_main_Button_register); checkBox.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(checkBox.isChecked()) regist_button.setEnabled(true); else regist_button.setEnabled(false); } }); sex_radiogroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if(checkedId==R.id.activity_main_RadioButton_man) sex='男'; else if(checkedId==R.id.activity_main_RadioButton_woman) sex='女'; } }); regist_button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(username_EText.getText().toString().length() == 0){ Toast.makeText(MainActivity.this,"用户名不能为空", Toast.LENGTH_SHORT).show(); } else if(passwd_EText.getText().toString().length() == 0 ||passwd_EText_reptition.getText().toString().length() == 0){ Toast.makeText(MainActivity.this,"密码不能为空", Toast.LENGTH_SHORT).show(); } else if(!passwd_EText.getText().toString().equals(passwd_EText_reptition.getText().toString())){ Toast.makeText(MainActivity.this,"密码不一致", Toast.LENGTH_SHORT).show(); } else { Intent intent=new Intent(MainActivity.this,OtherActivity.class); Bundle bundle=new Bundle(); bundle.putString("username",username_EText.getText().toString()); bundle.putChar("sex", sex); bundle.putString("phonenum",phonenum_EText.getText().toString()); bundle.putString("QQ",QQ_EText.getText().toString()); intent.putExtras(bundle); startActivity(intent); } } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } ``` OtherActivity.java ``` import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class OtherActivity extends Activity { private Button button=null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_other); button=(Button)findViewById(R.id.activity_other_Button); Bundle bundle=this.getIntent().getExtras(); TextView username=(TextView)findViewById(R.id.activity_other_username); username.setText(bundle.getString("username")); while(bundle.getString("sex") != null){ TextView phonenum=(TextView)findViewById(R.id.activity_other_sex); phonenum.setText(bundle.getString("sex")); } while(bundle.getString("phonenum") != null){ TextView phonenum=(TextView)findViewById(R.id.activity_other_phonenum); phonenum.setText(bundle.getString("phonenum")); } while(bundle.getString("QQ") != null){ TextView phonenum=(TextView)findViewById(R.id.activity_other_QQ); phonenum.setText(bundle.getString("QQ")); } button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(OtherActivity.this, "注册成功,等待进入主界面", Toast.LENGTH_LONG).show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.other, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } ```
相见恨晚的超实用网站
搞学习 知乎:www.zhihu.com 简答题:http://www.jiandati.com/ 网易公开课:https://open.163.com/ted/ 网易云课堂:https://study.163.com/ 中国大学MOOC:www.icourse163.org 网易云课堂:study.163.com 哔哩哔哩弹幕网:www.bilibili.com 我要自学网:www.51zxw
花了20分钟,给女朋友们写了一个web版群聊程序
参考博客 [1]https://www.byteslounge.com/tutorials/java-ee-html5-websocket-example
爬虫福利二 之 妹子图网MM批量下载
爬虫福利一:27报网MM批量下载    点击 看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成! 目标网站:妹子图网 环境:Python3.x 相关第三方模块:requests、beautifulsoup4 Re:各位在测试时只需要将代码里的变量 path 指定为你当前系统要保存的路径,使用 python xxx.py 或IDE运行即可。
字节跳动视频编解码面经
引言 本文主要是记录一下面试字节跳动的经历。 三四月份投了字节跳动的实习(图形图像岗位),然后hr打电话过来问了一下会不会opengl,c++,shador,当时只会一点c++,其他两个都不会,也就直接被拒了。 七月初内推了字节跳动的提前批,因为内推没有具体的岗位,hr又打电话问要不要考虑一下图形图像岗,我说实习投过这个岗位不合适,不会opengl和shador,然后hr就说秋招更看重基础。我当时
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
Python 基础(一):入门必备知识
目录1 标识符2 关键字3 引号4 编码5 输入输出6 缩进7 多行8 注释9 数据类型10 运算符10.1 常用运算符10.2 运算符优先级 1 标识符 标识符是编程时使用的名字,用于给变量、函数、语句块等命名,Python 中标识符由字母、数字、下划线组成,不能以数字开头,区分大小写。 以下划线开头的标识符有特殊含义,单下划线开头的标识符,如:_xxx ,表示不能直接访问的类属性,需通过类提供
这30个CSS选择器,你必须熟记(上)
关注前端达人,与你共同进步CSS的魅力就是让我们前端工程师像设计师一样进行网页的设计,我们能轻而易举的改变颜色、布局、制作出漂亮的影音效果等等,我们只需要改几行代码,不需...
国产开源API网关项目进入Apache孵化器:APISIX
点击蓝色“程序猿DD”关注我回复“资源”获取独家整理的学习资料!近日,又有一个开源项目加入了这个Java开源界大名鼎鼎的Apache基金会,开始进行孵化器。项目名称:AP...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
编写Spring MVC控制器的14个技巧
本期目录 1.使用@Controller构造型 2.实现控制器接口 3.扩展AbstractController类 4.为处理程序方法指定URL映射 5.为处理程序方法指定HTTP请求方法 6.将请求参数映射到处理程序方法 7.返回模型和视图 8.将对象放入模型 9.处理程序方法中的重定向 10.处理表格提交和表格验证 11.处理文件上传 12.在控制器中自动装配业务类 ...
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
求小姐姐抠图竟遭白眼?痛定思痛,我决定用 Python 自力更生!
点击蓝色“Python空间”关注我丫加个“星标”,每天一起快乐的学习大家好,我是 Rocky0429,一个刚恰完午饭,正在用刷网页浪费生命的蒟蒻...一堆堆无聊八卦信息的网页内容慢慢使我的双眼模糊,一个哈欠打出了三斤老泪,就在此时我看到了一张图片:是谁!是谁把我女朋友的照片放出来的!awsl!太好看了叭...等等,那个背景上的一堆鬼画符是什么鬼?!真是看不下去!叔叔婶婶能忍,隔壁老王的三姨妈的四表...
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
相关热词 c# 二进制截断字符串 c#实现窗体设计器 c#检测是否为微信 c# plc s1200 c#里氏转换原则 c# 主界面 c# do loop c#存为组套 模板 c# 停掉协程 c# rgb 读取图片
立即提问