Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > Mobile > Mobile Forum > รัน apk โดยใช้ android studio ผลลัพธ์ได้ error ตามข้างล่าง เมื่อดู code ไม่มีอะไร error สีแดงขึ้นทุกบรรทัด ปัญหานี้ควรแก้ไขอย่างไร



 

รัน apk โดยใช้ android studio ผลลัพธ์ได้ error ตามข้างล่าง เมื่อดู code ไม่มีอะไร error สีแดงขึ้นทุกบรรทัด ปัญหานี้ควรแก้ไขอย่างไร

 



Topic : 128081



โพสกระทู้ ( 66 )
บทความ ( 0 )



สถานะออฟไลน์




รัน apk โดยใช้ android studio ผลลัพธ์ได้ error ตามข้างล่าง เมื่อดู code ไม่มีอะไร error สีแดงขึ้นทุกบรรทัด ปัญหานี้ควรแก้ไขอย่างไร
Code
Information:Gradle tasks [:app:assembleDebug] Error:trouble processing "java/awt/font/NumericShaper.class": Error:Ill-advised or mistaken usage of a core class (java.* or javax.*) Error:when not building a core library. Error:This is often due to inadvertently including a core library file Error:in your application's project, when using an IDE (such as Error:Eclipse). If you are sure you're not intentionally defining a Error:core class, then this is the most likely explanation of what's Error:going on. Error:However, you might actually be trying to define a class in a core Error:namespace, the source of which you may have taken, for example, Error:from a non-Android virtual machine project. This will most Error:assuredly not work. At a minimum, it jeopardizes the Error:compatibility of your app with future versions of the platform. Error:It is also often of questionable legality. Error:If you really intend to build a core library -- which is only Error:appropriate as part of creating a full virtual machine Error:distribution, as opposed to compiling an application -- then use Error:the "--core-library" option to suppress this error message. Error:If you go ahead and use "--core-library" but are in fact Error:building an application, then be forewarned that your application Error:will still fail to build or run, at some point. Please be Error:prepared for angry customers who find, for example, that your Error:application ceases to function once they upgrade their operating Error:system. You will be to blame for this problem. Error:If you are legitimately using some code that happens to be in a Error:core package, then the easiest safe alternative you have is to Error:repackage that code. That is, move the classes in question into Error:your own package namespace. This means that they will never be in Error:conflict with core system classes. JarJar is a tool that may help Error:you in this endeavor. If you find that you cannot do this, then Error:that is an indication that the path you are on will ultimately Error:lead to pain, suffering, grief, and lamentation. Error:1 error; aborting Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --force-jumbo --num-threads=4 --multi-dex --output D:\Android\MyApplication\app\build\intermediates\transforms\dex\debug\folders\1000\2\android-3.1_be4ac94dd1bb49eef4fb269638f5d238e8794afb D:\Android\MyApplication\app\libs\android-3.1.jar} Information:BUILD FAILED

Code (Android-Java)
MyActivity.java
package com.myapplication;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

public class MyActivity extends Activity implements OnClickListener {

    Button btn_select;
    TextView tv_res;
    EditText txt_hn;
    EditText txt_name;
    EditText txt_age;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_my);
        tv_res = (TextView)findViewById(R.id.tv_res);
        txt_hn = (EditText)findViewById(R.id.txt_hn);
        txt_name = (EditText)findViewById(R.id.txt_name);
        txt_age = (EditText)findViewById(R.id.txt_age);
        btn_select = (Button)findViewById(R.id.btn_select);
        btn_select.setOnClickListener(this);
    }
    @Override
    public void onClick(View v){
        switch(v.getId()){
            case R.id.btn_select:
            {
                select();
                break;
            }
        }
    }
    
    public void clsText(){
        txt_hn.setText("");
        txt_name.setText("");
        txt_age.setText("");
    }

    public void select() {
        tv_res.setText("");
        InputStream is = null;
        String js_result = "";
        try {
            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost("http://localhost/testAndroid/get_data.php");
            HttpResponse response = httpclient.execute(httppost);
            HttpEntity entity = response.getEntity();
            is = entity.getContent();
        } catch (Exception e) {
            Log.d("log_err", "Error in http connection " + e.toString());
        }
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
                    StringBuilder sb = new StringBuilder();
            String line = null;
            while ((line = reader.readLine()) != null) {
                sb.append(line);
            }
            is.close();
            js_result = sb.toString();
        } catch (Exception e) {
            Log.e("log_tag", "Error converting result " + e.toString());
        }
        try {
            final JSONArray jArray = new JSONArray(js_result);
            for (int i = 0; i < jArray.length(); i++) {
                JSONObject jo = jArray.getJSONObject(i);
                String hn = jo.getString("hn");
                String name = jo.getString("name");
                String age = String.valueOf(jo.getInt("age"));
                String date_serv = jo.getString("date_serv");
                Log.d("log",hn+","+name+","+age+","+date_serv);
                tv_res.append(hn+","+name+","+age+","+date_serv+"\n");
            }
        } catch (JSONException e) {
            Log.e("log_tag", "Error parsing data " + e.toString());
        }
    }
}

Code (XML)
activity_main_my.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    tools:context=".MyActivity">

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Connect To Mysql Example" />
    <EditText
        android:id="@+id/txt_hn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="HN" >
    </EditText>

    <EditText
        android:id="@+id/txt_name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Name-Lastname" />

    <EditText
        android:id="@+id/txt_age"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Age" />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/btn_select"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Select" />

    </LinearLayout>
    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"></ScrollView>
    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
</LinearLayout>
    <TextView
        android:id="@+id/tv_res"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

    </LinearLayout>
    <ScrollView

        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent" ></LinearLayout>
    </ScrollView>
</LinearLayout>




Tag : Mobile







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2017-06-23 16:41:57 By : mininova View : 2120 Reply : 1
 

 

No. 1

Guest


มีปัญหาเกี่ยวกับ build.gradle นะคะ ลองสร้างโปรเจคใหม่ดูค่ะ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-06-26 11:43:10 By : taohuh
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : รัน apk โดยใช้ android studio ผลลัพธ์ได้ error ตามข้างล่าง เมื่อดู code ไม่มีอะไร error สีแดงขึ้นทุกบรรทัด ปัญหานี้ควรแก้ไขอย่างไร
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่