简体   繁体   English

在eclipse中导出Android项目

[英]Export an Android project in eclipse

I want to export my Android project in order to publish on Google Play. 我想导出我的Android项目以便在Google Play上发布。 It got exported successfully. 它已成功导出。

look at these lines of code: 看一下这些代码行:

GsonSyncPathResolverModel gsonSyncPathResolverModel = new GsonSyncPathResolverModel(new GsonBuilder());
            String TAG = "SyncPathReslover";

            HttpResponse licenceManagementResponse = Client.get(REST_URL.GETSynchURLResolver(customerID));
            int responseCode = licenceManagementResponse.getStatusLine().getStatusCode();
            String responseString = EntityUtils.toString(licenceManagementResponse.getEntity());
            Log.e(TAG, "response " + responseString);
            System.out.println(responseString);
            responseString=responseString.replace("{\"GetOrganizationInformationByOrganizationNumberResult\":\"[{","{");
            responseString=responseString.replace("}]\"}","}");
            responseString=responseString.replace('\\', Character.MIN_VALUE);
            responseString=responseString.replaceAll(""+Character.MIN_VALUE,"");

            System.out.println("#zzz "+responseString);

            if (responseCode == 200) {
                // syncPathResolver
                licenceManagementResponse.getEntity().consumeContent();
                SyncPathResolverModel syncPathResolverModel = gsonSyncPathResolverModel.parseJSON(responseString);

                Log.e(TAG, "Response from Server:  Organization ID:" + syncPathResolverModel.getObjectEntry_ID());
                Log.e(TAG, "Response from Server:  Sync Path:" + syncPathResolverModel.getSyncServiceURL());

When I run the project directly from the eclipse, The last line of code works fine, and print out the proper value. 当我直接从Eclipse运行项目时,最后一行代码可以正常工作,并输出正确的值。

but when I use the exported .apk file, 但是当我使用导出的.apk文件时,

Log.e(TAG, "Response from Server:  Organization ID:" + syncPathResolverModel.getObjectEntry_ID());
Log.e(TAG, "Response from Server:  Sync Path:" + syncPathResolverModel.getSyncServiceURL());

These two lines print out null . 这两行显示为null

Can you help me what is the problem with exporting the .apk file? 您能帮我导出.apk文件有什么问题吗?

It seems that the gson.jar library does not work when I signed the .apk file 当我对.apk文件签名时,gson.jar库似乎无法正常工作

The reason that json.jar file did not work properly after export the .apk files was related to enabling ProGuard . 导出.apk文件后json.jar文件无法正常工作的原因与启用ProGuard有关 So if I disable it or configure it properly, the .jar files will also work properly. 因此,如果我禁用它或对其进行正确配置,.jar文件也将正常运行。

Open the project properties in Eclipse. 在Eclipse中打开项目属性。 Select Java Build Path, click the Order and Export tab. 选择Java Build Path,单击Order and Export选项卡。 Make sure gson.jar is checked for export. 确保已检查gson.jar的导出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM