android - I updated an App but its failed. Missing type parameter in ProGuard -
i updated application had same code, in version didn't have problems in proguard. when launch app since androidstudio don't have problems, when launch signed app in parts of app can show error:
07-21 14:45:02.156 24372-24372/pe.gob.devida e/androidruntime﹕ fatal exception: main java.lang.runtimeexception: missing type parameter. @ com.google.a.c.a.a(unknown source) @ com.google.a.c.a.<init>(unknown source) @ pe.gob.devida.fragments.c.<init>(unknown source) @ pe.gob.devida.fragments.b.a(unknown source) @ pe.gob.devida.fragments.b.a(unknown source) @ com.a.a.a.o.c(unknown source) @ com.a.a.a.o.b(unknown source) @ com.a.a.i.run(unknown source) @ android.os.handler.handlecallback(handler.java:730) @ android.os.handler.dispatchmessage(handler.java:92) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5103) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:525) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:737) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553) @ dalvik.system.nativestart.main(native method) 07-21 14:45:02.584 24372-32210/pe.gob.devida e/google maps android api﹕ authorization failure. please see https://developers.google.com/maps/documentation/android/start how correctly set map. 07-21 14:45:02.588 24372-32210/pe.gob.devida e/google maps android api﹕ in google developer console (https://console.developers.google.com) ensure "google maps android api v2" enabled. ensure following android key exists: api key: your_key_here android application (<cert_fingerprint>;<package_name>): 9a:69:09:32:33:57:c3:8b:42:35:e7:82:07:6c:f9:df:82:a0:ad:2b;pe.gob.devida
the apikey exists , "google maps android api v2" enabled
i think problem in proguard-rules.pro
# add project specific proguard rules here. # default, flags in file appended flags specified # in c:\users\diego\appdata\local\android\sdk/tools/proguard/proguard-android.txt # can edit include path , order changing proguardfiles # directive in build.gradle. # # more details, see # http://developer.android.com/guide/developing/tools/proguard.html # add project specific keep options here: -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers -dontpreverify -verbose -dontwarn pe.gob.devida.** -dontwarn org.simpleframework.** -dontwarn com.squareup.picasso.** -dontwarn com.parse.** -dontwarn com.google.gsom.** -keep public class * extends pe.gob.devida.activities.baseactivity -keep public class * extends pe.gob.devida.fragments.basefragment # if project uses webview js, uncomment following # , specify qualified class name javascript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #}
errors occurred in classes extended of baseactivity , basefragment when use gson.
baseactivity.class
package pe.gob.devida.activities; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.progressbar; import android.widget.toast; import com.android.volley.authfailureerror; import com.android.volley.defaultretrypolicy; import com.android.volley.request; import com.android.volley.requestqueue; import com.android.volley.response; import com.android.volley.toolbox.stringrequest; import pe.gob.devida.volley.volleysingleton; import java.util.map; /** * created diego on 14/06/2015. */ public abstract class baseactivity extends appcompatactivity { private volleysingleton singleton; protected requestqueue frequestqueue; private static final int time_out = 10000, num_retry = 3; private progressbar progressbar; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); singleton = volleysingleton.getinstance(this.getapplicationcontext()); frequestqueue = singleton.getrequestqueue(); progressbar = new progressbar(this); } public void addtoqueue(request request) { onprestartconnection(); if (request != null) { request.settag(this); if (frequestqueue == null) frequestqueue = singleton.getrequestqueue(); request.setretrypolicy(new defaultretrypolicy(time_out, num_retry, defaultretrypolicy.default_backoff_mult)); frequestqueue.add(request); } } public void onprestartconnection() { setprogressbarindeterminatevisibility(true); } public void onconnectionfinished() { setprogressbarindeterminatevisibility(false); } public void onconnectionfailed(string error) { setprogressbarindeterminatevisibility(false); toast.maketext(this, error, toast.length_long).show(); } public void makestringrequest(int method, string url, response.listener<string> listener, response.errorlistener errorlistener, final map headers, final map params) { stringrequest request = new stringrequest(method, url, listener, errorlistener) { @override public map<string, string> getheaders() throws authfailureerror { return headers; } @override protected map<string, string> getparams() throws authfailureerror { return params; } }; addtoqueue(request); } public void makestringrequest(int method, string url, response.listener<string> listener, response.errorlistener errorlistener) { stringrequest request = new stringrequest(method, url, listener, errorlistener); addtoqueue(request); } protected abstract response.listener getlistener(); protected abstract response.errorlistener geterrorlistener(); }
basefragment.class
public abstract class basefragment extends fragment { private volleysingleton singleton; protected requestqueue frequestqueue; private static final int time_out = 10000, num_retry = 3; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); singleton = volleysingleton.getinstance(getactivity().getapplicationcontext()); frequestqueue = singleton.getrequestqueue(); } public void addtoqueue(request request) { if (request != null) { request.settag(this); if (frequestqueue == null) frequestqueue = singleton.getrequestqueue(); request.setretrypolicy(new defaultretrypolicy(time_out, num_retry, defaultretrypolicy.default_backoff_mult)); onprestartconnection(); frequestqueue.add(request); } } public void onprestartconnection() { getactivity().setprogressbarindeterminatevisibility(true); } public void onconnectionfinished() { getactivity().setprogressbarindeterminatevisibility(false); } public void onconnectionfailed(string error) { getactivity().setprogressbarindeterminatevisibility(false); toast.maketext(getactivity(), error, toast.length_long).show(); } public void makestringrequest(int method, string url, response.listener<string> listener, response.errorlistener errorlistener, final map headers, final map params) { onprestartconnection(); stringrequest request = new stringrequest(method, url, listener, errorlistener) { @override public map<string, string> getheaders() throws authfailureerror { return headers; } @override protected map<string, string> getparams() throws authfailureerror { return params; } }; } public void makestringrequest(int method, string url, response.listener<string> listener, response.errorlistener errorlistener) { onprestartconnection(); stringrequest request = new stringrequest(method, url, listener, errorlistener); addtoqueue(request); } public void makestringrequest(int method, string url) { onprestartconnection(); stringrequest request = new stringrequest(method, url, getlistener(), geterrorlistener()); addtoqueue(request); } protected abstract response.listener getlistener(); protected abstract response.errorlistener geterrorlistener(); }
the log showed when opened fragment: centrosfragment.class
public class centrosfragment extends basefragment implements onmapreadycallback { supportmapfragment mapfragment; googlemap gmap; private list<markeroptions> list = collections.emptylist(); private list<establecimiento> data = collections.emptylist(); private final static string url ="http://www.eljade.com.pe/app/obtener_establecimientos.php"; public centrosfragment() { // required empty public constructor } @override public void onresume() { super.onresume(); if (android.os.build.version.sdk_int > 12) { strictmode.threadpolicy policy = new strictmode.threadpolicy.builder() .permitall().build(); strictmode.setthreadpolicy(policy); } } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view root = inflater.inflate(r.layout.fragment_centros, container, false); mapfragment = (supportmapfragment) this.getchildfragmentmanager() .findfragmentbyid(r.id.centrosmap); mapfragment.getmapasync(this); return root; } @override public void onmapready(googlemap googlemap) { gmap = googlemap; gmap.setmaptype(googlemap.map_type_normal); gmap.getuisettings().setzoomcontrolsenabled(true); gmap.setmylocationenabled(true); latlng myposition = new latlng(-12.046374, -77.0427934); gmap.movecamera(cameraupdatefactory.newlatlngzoom(myposition, constant.first_zoom)); makestringrequest(request.method.get, url); /*getdata(); (int = 0; < list.size(); i++) { gmap.addmarker(list.get(i)); }*/ } @override protected response.listener getlistener() { return new response.listener<string>() { @override public void onresponse(string response) { type listtype = new typetoken<list<establecimiento>>() {}.gettype(); data = new gson().fromjson(response, listtype); (int = 0; i<data.size(); i++){ gmap.addmarker(data.get(i).getmarker()); } } }; } @override protected response.errorlistener geterrorlistener() { return new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { } }; } }
i solved problem this:
proguard:
-renamesourcefileattribute sourcefile -keepattributes signature,sourcefile,linenumbertable -keep public class * extends android.app.application
Comments
Post a Comment