Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialabdul rehman
Python Web Development Techdegree Student 1,025 Pointsat that point i does'nt have error !
At that point i doesn't have an error like shown in video , but in may logcat :
05-04 18:01:36.958 1758-1758/browsetolearn.com.stormy D/dalvikvm﹕ Late-enabling CheckJNI 05-04 18:01:37.022 1758-1758/browsetolearn.com.stormy I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations 05-04 18:01:37.022 1758-1758/browsetolearn.com.stormy W/dalvikvm﹕ VFY: unable to resolve virtual method 405: Landroid/content/res/TypedArray;.getChangingConfigurations ()I 05-04 18:01:37.022 1758-1758/browsetolearn.com.stormy D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002 05-04 18:01:37.022 1758-1758/browsetolearn.com.stormy I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType 05-04 18:01:37.022 1758-1758/browsetolearn.com.stormy W/dalvikvm﹕ VFY: unable to resolve virtual method 427: Landroid/content/res/TypedArray;.getType (I)I 05-04 18:01:37.022 1758-1758/browsetolearn.com.stormy D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002 05-04 18:01:37.046 1758-1761/browsetolearn.com.stormy D/dalvikvm﹕ GC_CONCURRENT freed 206K, 3% free 8742K/8980K, paused 3ms+0ms, total 7ms 05-04 18:01:37.046 1758-1758/browsetolearn.com.stormy E/MainActivity﹕ Exception Caught : java.io.IOException: Illegal character in path at index 65: https://api.forecast.io/forecast/7721c98a5e54fd53839ee2f0cd52b97e /,37.8267,-122.423 at com.squareup.okhttp.Request.uri(Request.java:66) at com.squareup.okhttp.internal.http.RouteSelector.get(RouteSelector.java:89) at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:316) at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:241) at com.squareup.okhttp.Call.getResponse(Call.java:271) at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:228) at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:199) at com.squareup.okhttp.Call.execute(Call.java:79) at browsetolearn.com.stormy.MainActivity.onCreate(MainActivity.java:33) at android.app.Activity.performCreate(Activity.java:5104) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) at android.app.ActivityThread.access$600(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5041) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method) 05-04 18:01:37.150 1758-1758/browsetolearn.com.stormy D/libEGL﹕ loaded /system/lib/egl/libEGL_genymotion.so 05-04 18:01:37.150 1758-1758/browsetolearn.com.stormy D/﹕ HostConnection::get() New Host Connection established 0xb7e215b8, tid 1758 05-04 18:01:37.678 1758-1758/browsetolearn.com.stormy D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_genymotion.so 05-04 18:01:37.678 1758-1758/browsetolearn.com.stormy D/libEGL﹕ loaded /system/lib/egl/libGLESv2_genymotion.so 05-04 18:01:38.902 1758-1758/browsetolearn.com.stormy W/EGL_genymotion﹕ eglSurfaceAttrib not implemented 05-04 18:01:38.950 1758-1758/browsetolearn.com.stormy D/OpenGLRenderer﹕ Enabling debug mode 0
8 Answers
Kristen Law
16,244 PointsHey Abdul! Looks like you have another small error in your code that's preventing you from getting the error that Ben gets in the video:
Exception Caught : java.io.IOException: Illegal character in path at index 65: https://api.forecast.io/forecast/7721c98a5e54fd53839ee2f0cd52b97e /,37.8267,-122.423 at com.squareup.okhttp.Request.uri(Request.java:66)
Basically there's an illegal character in your url at index 65 that is causing this IOException. If you count through up to index 65 or just take a look at what it should look like, you should see that the comma before 37.8267 is the illegal character and should be removed.
abdul rehman
Python Web Development Techdegree Student 1,025 Pointshy Kristen Law! Thanks for your reply! But i try it by putting the complete url in a single String variable without cancatination like that: String forecastUrl = "https://api.forecast.io/forecast/42059c9c877227d21ef20c13e94aa4f4/37.8267,-122.423";
And it's again doesn't show the error, which should appears!
Kristen Law
16,244 PointsWhat error are you getting? Can you post your logcat again? And maybe also post your MainActivity.java file?
abdul rehman
Python Web Development Techdegree Student 1,025 Pointspackage browsetolearn.com.stormy;
import android.app.Activity;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import com.squareup.okhttp.Call;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;
public class MainActivity extends Activity {
public static final String TAG = MainActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String forecastUrl = "https://api.forecast.io/forecast/42059c9c877227d21ef20c13e94aa4f4/37.8267,-122.423";
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(forecastUrl).build();
Call call = client.newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Request request, IOException e) {
}
@Override
public void onResponse(Response response) throws IOException {
try {
if(response.isSuccessful()){
Log.v(TAG, response.body().string());
}
} catch (IOException e) {
Log.e(TAG, "Exception Caught :", e);
}
}
});
}
}
My Logcat :
05-05 16:37:08.342 1566-1566/browsetolearn.com.stormy D/dalvikvm﹕ Late-enabling CheckJNI 05-05 16:37:09.234 1566-1566/browsetolearn.com.stormy D/libEGL﹕ loaded /system/lib/egl/libEGL_genymotion.so 05-05 16:37:09.238 1566-1566/browsetolearn.com.stormy D/﹕ HostConnection::get() New Host Connection established 0xb8cbd710, tid 1566 05-05 16:37:09.266 1566-1566/browsetolearn.com.stormy D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_genymotion.so 05-05 16:37:09.266 1566-1566/browsetolearn.com.stormy D/libEGL﹕ loaded /system/lib/egl/libGLESv2_genymotion.so 05-05 16:37:09.454 1566-1566/browsetolearn.com.stormy W/EGL_genymotion﹕ eglSurfaceAttrib not implemented 05-05 16:37:09.490 1566-1566/browsetolearn.com.stormy D/OpenGLRenderer﹕ Enabling debug mode 0
Kristen Law
16,244 PointsI don't see an error in your logcat, are you not getting an error at all? Also, have you moved ahead to the next few videos? Looks like you already implemented some code from this video. If you have also added the INTERNET permission to your AndroidManifest.xml file, then what you have is correct, and you should be receiving no errors.
abdul rehman
Python Web Development Techdegree Student 1,025 Pointsyah!i have been added Internet permission, But now it should appears data from Api to my logcat? Data doesn't appears! What's may be be the wrong with my application?
Kristen Law
16,244 PointsI can't see any immediate issues with your code. Can you make sure the Log level is set to verbose and that you have no filters in the search bar?
It should look something like this:
abdul rehman
Python Web Development Techdegree Student 1,025 Pointsyah! All of these settings are same ...
abdul rehman
Python Web Development Techdegree Student 1,025 PointsKristen! what's i ahve seen in my logcat after taking some modification from next vides after adding alert dialog : AND also itried it with imported project which downloads from Treehouse: My Logcat: 05-06 08:03:03.552 1928-1928/teamtreehouse.com.stormy D/dalvikvm﹕ Late-enabling CheckJNI 05-06 08:03:03.700 1928-1928/teamtreehouse.com.stormy I/dalvikvm﹕ Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted 05-06 08:03:03.700 1928-1928/teamtreehouse.com.stormy W/dalvikvm﹕ VFY: unable to resolve virtual method 11344: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V 05-06 08:03:03.704 1928-1928/teamtreehouse.com.stormy D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000 05-06 08:03:03.704 1928-1928/teamtreehouse.com.stormy I/dalvikvm﹕ Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll 05-06 08:03:03.704 1928-1928/teamtreehouse.com.stormy W/dalvikvm﹕ VFY: unable to resolve virtual method 11350: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V 05-06 08:03:03.704 1928-1928/teamtreehouse.com.stormy D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000 05-06 08:03:03.712 1928-1928/teamtreehouse.com.stormy I/dalvikvm﹕ Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled 05-06 08:03:03.712 1928-1928/teamtreehouse.com.stormy W/dalvikvm﹕ VFY: unable to resolve virtual method 9038: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V 05-06 08:03:03.712 1928-1928/teamtreehouse.com.stormy D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000e 05-06 08:03:03.732 1928-1928/teamtreehouse.com.stormy I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations 05-06 08:03:03.732 1928-1928/teamtreehouse.com.stormy W/dalvikvm﹕ VFY: unable to resolve virtual method 367: Landroid/content/res/TypedArray;.getChangingConfigurations ()I 05-06 08:03:03.736 1928-1928/teamtreehouse.com.stormy D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002 05-06 08:03:03.744 1928-1928/teamtreehouse.com.stormy I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType 05-06 08:03:03.744 1928-1928/teamtreehouse.com.stormy W/dalvikvm﹕ VFY: unable to resolve virtual method 389: Landroid/content/res/TypedArray;.getType (I)I 05-06 08:03:03.744 1928-1928/teamtreehouse.com.stormy D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002 05-06 08:03:03.796 1928-1928/teamtreehouse.com.stormy D/MainActivity﹕ Main UI code is running! 05-06 08:03:03.864 1928-1928/teamtreehouse.com.stormy D/libEGL﹕ loaded /system/lib/egl/libEGL_genymotion.so 05-06 08:03:03.868 1928-1928/teamtreehouse.com.stormy D/﹕ HostConnection::get() New Host Connection established 0xb8a40618, tid 1928 05-06 08:03:12.856 1928-1928/teamtreehouse.com.stormy D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_genymotion.so 05-06 08:03:12.856 1928-1928/teamtreehouse.com.stormy D/libEGL﹕ loaded /system/lib/egl/libGLESv2_genymotion.so 05-06 08:03:34.184 1928-1928/teamtreehouse.com.stormy W/EGL_genymotion﹕ eglSurfaceAttrib not implemented 05-06 08:03:34.348 1928-1928/teamtreehouse.com.stormy D/OpenGLRenderer﹕ Enabling debug mode 0
Kristen Law
16,244 PointsHey Abdul! I've never run into that error before but if you try to google your error (ex: "Could not find method android.view.ViewGroup.onNestedScrollAccepted") you may find others that ran into the same problem. If that does not help, I'd advise making a new post to the forum with your updated problem/question. Good luck!
abdul rehman
Python Web Development Techdegree Student 1,025 Pointshy Kristen! But i have find that my error is Broken Pipe, due to this error my data doesn't appears on Logcat, you know how to fix this error?
Kristen Law
16,244 PointsSounds like your emulator got disconnected from Android Studio somehow. Try restarting your emulator/Android Studio and see if that resolves the issue.
abdul rehman
Python Web Development Techdegree Student 1,025 Pointsyah! i have been restarted several time, but it doesn't resolve the error! Antoher point that's comes in my mind, i have been built another applications, nothing any other app seems this like error,but why this app got this error?
Kristen Law
16,244 PointsWhenever I have that issue, it is resolved by restarting, so I'm not sure what is happening in your situation. Once again, you can try googling your issue or asking a new question on the forum. Hope you get it working!