Click here to Skip to main content
15,744,384 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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.out.println("\t\tKLU SEMESTER MARK CALCULATOR Ver.1.00.0000\n\t\tProgrammed by N.Visweswaran.,DMO.,DCP.,\n\t\ 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);
                        System.out.println("\nHurrah! you have already passed in your examination");
                        end = (end - 40)/2;
                        System.out.println("\nAdditional marks that you have: " +end);

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.
Updated 22-Jun-20 16:02pm
Mohibur Rashid 9-Nov-15 3:16am    
Have you tried any tutorial at all? May be you should start with one.
I have no idea how you managed to build apk from this source code.. Did you just renamed your class file?
[no name] 9-Nov-15 5:45am    
Sir, Yes I think I've renamed the package name and just clicked the build button and it shows build successful and the time elapsed to build the application.

1 solution

VISWESWARAN1998 wrote:
Have I missed anything
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[^] and study some of the articles that explain how to do it.
Share this answer
[no name] 9-Nov-15 6:14am    
Yes Sir, think I've missed everything and 5. Thank you for your kind help.Those articles are really nice.
[no name] 10-Nov-15 6:25am    
Sir, Now by the articles provided by you I've learned something and filled the missing codes and my program crashes again.Now what shall I do either improve my question by updating the code or post a new question?Please kindly help me with this.
Richard MacCutchan 10-Nov-15 13:17pm    
I did not provide those articles, they were written by some of the CodeProject members who are Android experts. I think it would be best to mark this question as closed, and open a new one with details of your issue.
[no name] 10-Nov-15 13:31pm    
Sir, sorry I don't know how to close the question.I can't see the red cross icon.What should I do?
Richard MacCutchan 10-Nov-15 13:46pm    
You just need to edit (use the Improve question link above) and add the word "Closed" to the title.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900