我有罪啊,我用了一下午时间,终于无师自学,用C#开发了俺的第一个Android 浏览器APP,我对不起java 社区啊
--------------------编程问答-------------------- --------------------编程问答-------------------- 简单看了一下, 明显您用的是Java语言。。。Processing 'classes.dex'...
Opened 'classes.dex', DEX version '035'
Class #0 -
Class descriptor : 'Lmono/android/IGCUserPeer;'
Access flags : 0x0601 (PUBLIC INTERFACE ABSTRACT)
Superclass : 'Ljava/lang/Object;'
Interfaces -
Static fields -
Instance fields -
Direct methods -
Virtual methods -
#0 : (in Lmono/android/IGCUserPeer;)
name : 'monodroidAddReference'
type : '(Ljava/lang/Object;)V'
access : 0x0401 (PUBLIC ABSTRACT)
code : (none)
#1 : (in Lmono/android/IGCUserPeer;)
name : 'monodroidClearReferences'
type : '()V'
access : 0x0401 (PUBLIC ABSTRACT)
code : (none)
source_file_idx : 162 (IGCUserPeer.java) --------------------编程问答-------------------- 人家编译成了 java 及机器源码,楼上根本就不懂! --------------------编程问答--------------------
But, what u mean compile Java?
All android application is based on Java VM, I know what u mean is that U write a C# based application, and use a tool to transfer it to Java source file automaticly, right?
Any way, if so, the performance Must be poor. --------------------编程问答-------------------- 除 --------------------编程问答-------------------- vs2010 + android sdk 就可以开发了,不懂的自己去查查资料吧 --------------------编程问答-------------------- Many thanks. --------------------编程问答-------------------- 楼上的
呵呵,有时间多交流啊 --------------------编程问答-------------------- Activity1.cs 代码如下:
--------------------编程问答-------------------- 界面设计是可视化的,所见即所得的,比 netneans 和 eclipse 强多了,还有很多各种各样的控件!
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Webkit;
namespace hz.android.test
{
[Activity (Label = "hz.android.test", MainLauncher = true)]
public class Activity1 : Activity
{
int count = 1;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Main);
Button button = FindViewById<Button> (Resource.Id.myButton);
WebView webView = FindViewById<WebView> (Resource.Id.webView1);
button.Click += delegate {
button.Text = string.Format ("{0} clicks!", count++);
webView.LoadUrl("http://blog.csdn.net/tengyunjiawu_com/article/details/8565766");
};
}
}
}
netneans 和 eclipse 界面都要自己写 axml文件,这个能拖拉好之后自动生成:
layout/Main.axml
--------------------编程问答-------------------- Resource.designer.cs 这个相当于 netbeans 或 java 开发 Android时自动生成的
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/myButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<WebView
android:layout_width="fill_parent"
android:layout_height="220.7dp"
android:id="@+id/webView1"
android:layout_marginBottom="50.0dp" />
<EditText
android:inputType="textEmailAddress"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/editText1"
android:text="bwsyq@bwsyq.com QQ:99923309"
android:linksClickable="true" />
<DatePicker
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/datePicker1" />
<CheckedTextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/checkedTextView1" />
</LinearLayout>
r.java 类代码:
--------------------编程问答-------------------- --------------------编程问答-------------------- 调试的时候打开 ADV(android 模拟器) 在里面你自己添加一个机器的型号,设置好分辨率,内存大小,SD卡,启动之后,就可以调试了!
namespace hz.android.test
{
public partial class Resource
{
public partial class Attribute
{
private Attribute()
{
}
}
public partial class Drawable
{
// aapt resource value: 0x7f020000
public const int Icon = 2130837504;
// aapt resource value: 0x7f020001
public const int lbs = 2130837505;
private Drawable()
{
}
}
public partial class Id
{
// aapt resource value: 0x7f050004
public const int checkedTextView1 = 2131034116;
// aapt resource value: 0x7f050003
public const int datePicker1 = 2131034115;
// aapt resource value: 0x7f050002
public const int editText1 = 2131034114;
// aapt resource value: 0x7f050000
public const int myButton = 2131034112;
// aapt resource value: 0x7f050001
public const int webView1 = 2131034113;
private Id()
{
}
}
public partial class Layout
{
// aapt resource value: 0x7f030000
public const int Main = 2130903040;
private Layout()
{
}
}
public partial class String
{
// aapt resource value: 0x7f040001
public const int app_name = 2130968577;
// aapt resource value: 0x7f040000
public const int hello = 2130968576;
private String()
{
}
}
}
}
调试生成的代码是不能发布到真实的机器上的,因为 android 实际程序在真实机器中运行的时候会进行验证,这个在 netbeans 或 eclipse 里面叫 key.store
所以发布的时候,要用 netbeans 或 eclipse 里面一个叫 keytools的工具,生成一个 key.store的文件
使用格式如下:
D:\Progra~1\Java\jdk1.7.0_11\jre\bin\keytool -genkey -v -keystore xxx-release-key.keystore -alias xxxkeystore -keyalg RSA -keysize 2048 -validity 20000
您的名字与姓氏是什么?
[Unknown]: huangzhi
您的组织单位名称是什么?
[Unknown]: bwsyq co.ltd
您的组织名称是什么?
[Unknown]: bwsyq java develop group
您所在的城市或区域名称是什么?
[Unknown]: hang zhou
您所在的省/市/自治区名称是什么?
[Unknown]: hang zhou
该单位的双字母国家/地区代码是什么?
[Unknown]: 86
CN=huangzhi, OU=bwsyq co.ltd, O=bwsyq java develop group, L=hang zhou, ST=hang z
hou, C=86是否正确?
这样之后或要求你输入密码,这时候就会产生一个 xxx-release-key.keystore 的验证密码文件 别名叫: xxxkeystore
不论是 vs2010 还是 netbeans 还是 eclipse 在release的时候都会要求你输入密码,密码验证通过之后就会生成真正的发布安装文件 xxx.APK ,这个就是可以在真实机器上安装运行的 APP了!
例如:http://pan.baidu.com/share/link?shareid=367259&uk=201606611
这时后还不要高兴,这样编译的程序还只能运行一般的 APP ,如果要使用google 地图API ,你还要从 key.store中取出 MD5 密码
keytool -list -v -alias xxxkeystore -keystore xxx-release-key.keystore
通过这个 keytools的命令去取
然后到 http://www.google.com/glm/mmap google 地图网站获取一个根据 MD5生成的 地图 key
才能在你发布的程序中使用 google 地图 API
当然了,还有很多,比如如何注册,使用 admob 如何在你的应用中增加google 移动广告赚钱,等等,有兴趣的可以加入我们的QQ群一起探讨交流!
本人也是新手有任何建议、意见、需要代码的可与我本人联系 :QQ交流群:72133568, 27236303,74965947, 16592133, 204725117, 204724518 --------------------编程问答-------------------- 开发环境:vs2010 + android sdk 4.2 --------------------编程问答-------------------- --------------------编程问答-------------------- 不错,不能收藏帖子?
补充:移动开发 , Android