本文介绍了如何使用简单的Java程序生成apk [已关闭]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,我是Java的初学者。我在使用java程序构建apk时有很多疑点。我已经提到了许多网站,包括堆栈溢出,并且在开发Android应用程序时几乎没有什么想法。



我做的是:

1.下载Android工作室并构建一个签名的apk(成功构建)。

2.复制apk_release。 apk到我的手机并安装它(成功安装)。

3.当我打开已安装的.apk时,它显示不幸的是KLUVIS(我的文件名)已停止。

4.在我的Android手机中使用开发人员设置我启用了USB调试并使用adb.exe安装了应用程序。但是我遇到了同样的问题。

5.在互联网上提到了各种程序但是没有工作。



这是我的代码:

Sir, I am a beginner in Java.I have many doubts in building an apk using java program.I have referred many websites including stack overflow and got few ideas in developing an android application.

What I did is:
1. Downloaded Android studio and built a signed apk(Successful build).
2. Copied the apk_release.apk to my phone and installed it(Successful installation).
3. when I opened the installed .apk it shows me "unfortunately KLUVIS(my file name) has stopped.
4. Using developers settings in my android phone I have enabled USB debugging and installed the app using adb.exe.But the same problem which I have encountered.
5. Referred various procedures in internet but didn't work.

here is my code:

import java.util.Scanner;
public class KLUVIS {

    
    public static void main(String[] args) {
        int s1, s2, s3,h;
	float end;
	float assign;
        Scanner in = new Scanner(System.in);
        System.out.println("\t\tKLU SEMESTER MARK CALCULATOR Ver.1.00.0000\n\t\tProgrammed by N.Visweswaran.,DMO.,DCP.,\n\t\tB.tech(EEE) I year, Kalasalingam University(Batch:2015-2019)\n\t\tStudent of Prof.Sivanesh Kumar");
        System.out.println("\n\nFor how many subjects you want to calculate:  ");
        h= in.nextInt();
        for (int i = 1;i <= h;i++)
	{
        System.out.println("\nEnter your sessional one marks:  ");
        s1 = in.nextInt();
        System.out.println("\nEnter your sessional two marks:  ");
        s2 = in.nextInt();
        System.out.println("\nEnter your sessional three marks:  ");
        s3 = in.nextInt();
        System.out.println("\nEnter your assignment marks:  ");
        assign = in.nextFloat();
        end = (float) (((s1  + s2  + s3 ) / 7.5) + (assign / 10));
        System.out.println("\nYour current marks is " +end);
        if (end <= 40)
		{
			end = (40-end)*2;
                        System.out.println("\nMarks needed to pass in your end semester exam: " +end);
                }
        else
		{
                        System.out.println("\nHurrah! you have already passed in your examination");
                        end = (end - 40)/2;
                        System.out.println("\nAdditional marks that you have: " +end);
                }
        
    }
    }
}



我错过了构建apk的任何内容吗?请帮助我。



我在java中没有那么多的知识所以我不知道我将这个代码转换成apk。

由于我对C和C ++编程有足够的知识,我使用visual studio提供的跨平台android开发工具做了同样的事情,它显示了相同的消息。他们,请帮助我。


Have I missed anything to build an apk? Kindly help me.

I don't have that much knowledge in java so I dont know I to convert this code into apk.
Since I have an adequate knowledge in C and C++ programming I did the same using cross platform android development tool provided by visual studio and it shows the the same message.Sir,Kindly help me with this.

推荐答案

VISWESWARAN1998写道:
VISWESWARAN1998 wrote:

我错过了什么

是的,你错过了一切。您的代码不是可以在Android上运行的形式,因此难怪它会立即崩溃。转到 []并研究一些解释如何操作的文章。

Yes you have missed everything. Your code is not in a form that can run on Android, so it is no wonder it crashes immediately. Go to http://www.codeproject.com/KB/android/#Android+Tutorial+Contest[^] and study some of the articles that explain how to do it.


这篇关于如何使用简单的Java程序生成apk [已关闭]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 00:45