Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Java issue android Qt
Forum Update on Tuesday, May 27th 2025

Java issue android Qt

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 1 Posters 327 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ENSAO_CHEIKH
    wrote on last edited by
    #1

    Hello all,

    Please I am trying to code a programm in Java so that I could call it from c++ to do Wifi Scan and to get the Ip address of the gateway, but I make some mistake, here is the code below

    package org.qtproject.example.musiclist;
    
    
    
    import android.content.Context;
    import android.os.Bundle;
    import android.widget.TextView;
    import android.net.*;
    import android.net.wifi.WifiManager;
    
    
    
    public  class MusicList  {
    
        public String s_dns1;
        public String s_dns2;
        public String s_gateway;
        public String s_ipAddress;
        public String s_leaseDuration;
        public String s_netmask;
        public String s_serverAddress;
    
        DhcpInfo d;
        WifiManager wifii;
    
        /**
         * Called when the activity is first created.
    
         */
    
    
           public  void doTest(){
             wifii = (WifiManager)getSystemService(Context.WIFI_SERVICE);
             d = wifii.getDhcpInfo();
    
             s_dns1 = "DNS 1: " + String.valueOf(d.dns1);
             s_dns2 = "DNS 2: " + String.valueOf(d.dns2);
             s_gateway = "Default Gateway: " + String.valueOf(d.gateway);
             s_ipAddress = "IP Address: " + String.valueOf(d.ipAddress);
             s_leaseDuration = "Lease Time: " + String.valueOf(d.leaseDuration);
             s_netmask = "Subnet Mask: " + String.valueOf(d.netmask);
             s_serverAddress = "Server IP: " + String.valueOf(d.serverAddress);
    
             //dispaly them
             // info= (TextView) findViewById(R.id.infolbl);
             //info.setText("Network Info\n"+s_dns1+"\n"+s_dns2+"\n"+s_gateway+"\n"+s_ipAddress+"\n"+s_leaseDuration+"\n"+s_netmask+"\n"+s_serverAddress);
             System.out.println("s_gateway");
             System.out.println(s_serverAddress);
              System.out.println(s_gateway);
    
             }
    
         public  void tester(){
    
             System.out.println("Je teste Java");
              doTest();
             }
    
    
    
    }
    
    

    the error message is like :

    > Task :compileDebugJavaWithJavac FAILED
    D:\ProgQt\build-app-Android_for_armeabi_v7a_arm64_v8a_x86_x86_64_Clang_Qt_5_15_0_for_Android-Debug\android-build\src\org\qtproject\example\musiclist\MusicList.java:83: error: cannot find symbol
             this.wifii = (WifiManager)getSystemService(Context.WIFI_SERVICE);
                                       ^
      symbol:   method getSystemService(String)
      location: class MusicList
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    1 error
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':compileDebugJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 12s
    12 actionable tasks: 2 executed, 10 up-to-date
    Building the android package failed!
      -- For more information, run this command with --verbose.
    23:53:19: Le processus "D:\Qt\5.15.0\android\bin\androiddeployqt.exe" s'est terminé avec le code 14.
    Erreur lors de la compilation/déploiement du projet app (kit : Android for armeabi-v7a,arm64-v8a,x86,x86_64 (Clang Qt 5.15.0 for Android))
    When executing step "Build Android APK"
    23:53:19: Elapsed time: 00:21.
    
    1 Reply Last reply
    0
    • E Offline
      E Offline
      ENSAO_CHEIKH
      wrote on last edited by
      #2

      Please, any suggestion for this case?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved