我想知道是否需要为安卓重写我的代码。

huangapple go评论75阅读模式
英文:

I want to know if I've to rewrite my code for Android

问题

如果我用HTML、CSS和JS制作一个网站,我可以在个人电脑浏览器上运行它。那么我是否也能在Android手机浏览器上运行它?或者我必须使用像Java这样的不同编程语言?另外,我想知道类似Facebook、Twitter或Instagram的Android应用,必须使用哪些语言来制作?

英文:

If I make a website with HTML,CSS & JS, I can run this in PC browsers. Would I also be able to run it in Android mobile browsers? Or I have to use different programming language like Java? Also, I want to know is, Android apps like Facebook, Twitter or Instagram, what languages are compulsory to make them?

答案1

得分: 1

如果您没有使用任何ESNEXT功能,并且浏览器支持您使用的功能(https://caniuse.com/),您将能够在手机上使用该网站,是的。

如果您希望它成为一个原生应用程序(即您可以从应用商店下载的应用程序),您可以学习像Java这样的语言,或者使用React Native,它允许您使用类似于Web开发的语言语法制作移动应用。

英文:

If you're not using any ESNEXT features and the browser supports the features you're using (https://caniuse.com/), you will be able to use the website on a phone, yes.

If you want it to be a native application (i.e. one you can download from the app store), you could learn a language like Java OR use React Native, which allows you to make mobile apps with similar language syntax to web development.

答案2

得分: 1

在每个浏览器,无论是移动还是非移动,的核心是JavaScript。您绝对可以构建在其上运行的网站。但是,您将需要考虑实际上适用于这些浏览器的兼容性。您可以通过使用诸如 https://caniuse.com/ 的工具手动检查不同浏览器中是否支持某种方法或对象,或者您可以设置一个自动化解决方案,针对您的测试套件运行(您也可以手动使用这些工具进行测试,但自动化始终更受青睐),使用诸如 https://www.browserstack.com/ 的工具。

至于您的第二个问题,Android应用程序都是用Java编写的,不要将其与JavaScript混淆,并且必须编译才能在Android上运行。您将需要像IntelliJEclipse这样的编译器。

编辑:正如其他人指出的,您还可以使用诸如React NativeNativeScript这样的工具,将HTML/JavaScript编译为原生应用程序。

英文:

At the core of every browser, mobile or not, is JavaScript. You can absolutely build a website that runs on them. However, you will have to mind what is actually compatible for those. You can manually check to see if a certain method or object is supported in different browsers by using a tool like https://caniuse.com/ or you could set up an automated solution that would run against your test suite (you could also test with these tools manually, but automation is always preferred) with a tool like https://www.browserstack.com/

As far as your second question, android apps are all written in Java, not to be confused with JavaScript and have to be compiled to run on android. You'll need a compiler like IntelliJ or Eclipse

Edit: as someone else pointed out, you can also use a tool that might compile html/javascript into a native app with a tool like React Native or NativeScript

huangapple
  • 本文由 发表于 2020年10月14日 05:20:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/64343313.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定