<分区> 分区>
@Bini 这是我进行更改时的错误:(
09-26 11:06:05.620: D/dalvikvm(1613): Late-enabling CheckJNI
09-26 11:06:06.148: D/dalvikvm(1613): GC_FOR_ALLOC freed 51K, 4% free 3410K/3532K, paused 22ms, total 22ms
09-26 11:06:06.236: I/dalvikvm-heap(1613): Grow heap (frag case) to 17.093MB for 14369304-byte allocation
09-26 11:06:06.240: D/dalvikvm(1613): GC_FOR_ALLOC freed 2K, 1% free 17440K/17568K, paused 3ms, total 3ms
09-26 11:06:06.608: D/AndroidRuntime(1613): Shutting down VM
09-26 11:06:06.608: W/dalvikvm(1613): threadid=1: thread exiting with uncaught exception (group=0xa4d51b20)
09-26 11:06:06.608: E/AndroidRuntime(1613): FATAL EXCEPTION: main
09-26 11:06:06.608: E/AndroidRuntime(1613): Process: com.VaSuRa.sugboways, PID: 1613
09-26 11:06:06.608: E/AndroidRuntime(1613): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.VaSuRa.sugboways/com.VaSuRa.sugboways.MainActivity}: java.lang.ClassCastException: com.VaSuRa.sugboways.MainActivity cannot be cast to android.location.LocationListener
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.ActivityThread.access$800(ActivityThread.java:135)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.os.Handler.dispatchMessage(Handler.java:102)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.os.Looper.loop(Looper.java:136)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.ActivityThread.main(ActivityThread.java:5017)
09-26 11:06:06.608: E/AndroidRuntime(1613): at java.lang.reflect.Method.invokeNative(Native Method)
09-26 11:06:06.608: E/AndroidRuntime(1613): at java.lang.reflect.Method.invoke(Method.java:515)
09-26 11:06:06.608: E/AndroidRuntime(1613): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
09-26 11:06:06.608: E/AndroidRuntime(1613): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
09-26 11:06:06.608: E/AndroidRuntime(1613): at dalvik.system.NativeStart.main(Native Method)
09-26 11:06:06.608: E/AndroidRuntime(1613): Caused by: java.lang.ClassCastException: com.VaSuRa.sugboways.MainActivity cannot be cast to android.location.LocationListener
09-26 11:06:06.608: E/AndroidRuntime(1613): at com.VaSuRa.sugboways.MainActivity.onCreate(MainActivity.java:44)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.Activity.performCreate(Activity.java:5231)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
09-26 11:06:06.608: E/AndroidRuntime(1613): ... 11 more
这是第二个错误
09-26 11:06:05.620: D/dalvikvm(1613): Late-enabling CheckJNI
09-26 11:06:06.148: D/dalvikvm(1613): GC_FOR_ALLOC freed 51K, 4% free 3410K/3532K, paused 22ms, total 22ms
09-26 11:06:06.236: I/dalvikvm-heap(1613): Grow heap (frag case) to 17.093MB for 14369304-byte allocation
09-26 11:06:06.240: D/dalvikvm(1613): GC_FOR_ALLOC freed 2K, 1% free 17440K/17568K, paused 3ms, total 3ms
09-26 11:06:06.608: D/AndroidRuntime(1613): Shutting down VM
09-26 11:06:06.608: W/dalvikvm(1613): threadid=1: thread exiting with uncaught exception (group=0xa4d51b20)
09-26 11:06:06.608: E/AndroidRuntime(1613): FATAL EXCEPTION: main
09-26 11:06:06.608: E/AndroidRuntime(1613): Process: com.VaSuRa.sugboways, PID: 1613
09-26 11:06:06.608: E/AndroidRuntime(1613): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.VaSuRa.sugboways/com.VaSuRa.sugboways.MainActivity}: java.lang.ClassCastException: com.VaSuRa.sugboways.MainActivity cannot be cast to android.location.LocationListener
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.ActivityThread.access$800(ActivityThread.java:135)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.os.Handler.dispatchMessage(Handler.java:102)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.os.Looper.loop(Looper.java:136)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.ActivityThread.main(ActivityThread.java:5017)
09-26 11:06:06.608: E/AndroidRuntime(1613): at java.lang.reflect.Method.invokeNative(Native Method)
09-26 11:06:06.608: E/AndroidRuntime(1613): at java.lang.reflect.Method.invoke(Method.java:515)
09-26 11:06:06.608: E/AndroidRuntime(1613): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
09-26 11:06:06.608: E/AndroidRuntime(1613): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
09-26 11:06:06.608: E/AndroidRuntime(1613): at dalvik.system.NativeStart.main(Native Method)
09-26 11:06:06.608: E/AndroidRuntime(1613): Caused by: java.lang.ClassCastException: com.VaSuRa.sugboways.MainActivity cannot be cast to android.location.LocationListener
09-26 11:06:06.608: E/AndroidRuntime(1613): at com.VaSuRa.sugboways.MainActivity.onCreate(MainActivity.java:44)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.Activity.performCreate(Activity.java:5231)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-26 11:06:06.608: E/AndroidRuntime(1613): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
09-26 11:06:06.608: E/AndroidRuntime(1613): ... 11 more
这是让我头疼的日志,有人可以帮帮我吗?我非常需要这个...
09-26 09:26:43.281: D/dalvikvm(1209): Late-enabling CheckJNI
09-26 09:26:43.441: D/dalvikvm(1209): newInstance failed: p0 i0 [0 a1
09-26 09:26:43.441: D/AndroidRuntime(1209): Shutting down VM
09-26 09:26:43.445: W/dalvikvm(1209): threadid=1: thread exiting with uncaught exception (group=0xa4da2b20)
09-26 09:26:43.457: E/AndroidRuntime(1209): FATAL EXCEPTION: main
09-26 09:26:43.457: E/AndroidRuntime(1209): Process: com.VaSuRa.sugboways, PID: 1209
09-26 09:26:43.457: E/AndroidRuntime(1209): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.VaSuRa.sugboways/com.VaSuRa.sugboways.MainActivity}: java.lang.InstantiationException: can't instantiate class com.VaSuRa.sugboways.MainActivity
09-26 09:26:43.457: E/AndroidRuntime(1209): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
09-26 09:26:43.457: E/AndroidRuntime(1209): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
09-26 09:26:43.457: E/AndroidRuntime(1209): at android.app.ActivityThread.access$800(ActivityThread.java:135)
09-26 09:26:43.457: E/AndroidRuntime(1209): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
09-26 09:26:43.457: E/AndroidRuntime(1209): at android.os.Handler.dispatchMessage(Handler.java:102)
09-26 09:26:43.457: E/AndroidRuntime(1209): at android.os.Looper.loop(Looper.java:136)
09-26 09:26:43.457: E/AndroidRuntime(1209): at android.app.ActivityThread.main(ActivityThread.java:5017)
09-26 09:26:43.457: E/AndroidRuntime(1209): at java.lang.reflect.Method.invokeNative(Native Method)
09-26 09:26:43.457: E/AndroidRuntime(1209): at java.lang.reflect.Method.invoke(Method.java:515)
09-26 09:26:43.457: E/AndroidRuntime(1209): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
09-26 09:26:43.457: E/AndroidRuntime(1209): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
09-26 09:26:43.457: E/AndroidRuntime(1209): at dalvik.system.NativeStart.main(Native Method)
09-26 09:26:43.457: E/AndroidRuntime(1209): Caused by: java.lang.InstantiationException: can't instantiate class com.VaSuRa.sugboways.MainActivity
09-26 09:26:43.457: E/AndroidRuntime(1209): at java.lang.Class.newInstanceImpl(Native Method)
09-26 09:26:43.457: E/AndroidRuntime(1209): at java.lang.Class.newInstance(Class.java:1208)
09-26 09:26:43.457: E/AndroidRuntime(1209): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
09-26 09:26:43.457: E/AndroidRuntime(1209): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
09-26 09:26:43.457: E/AndroidRuntime(1209): ... 11 more
这是我的主要 Activity :
package com.VaSuRa.sugboways;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
public abstract class MainActivity extends Activity implements OnClickListener,
LocationListener {
LocationManager locationManager;
String provider;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
provider = locationManager.getBestProvider(criteria, false);
if (provider != null && !provider.equals("")) {
// Get the location from the given provider
Location location = locationManager.getLastKnownLocation(provider);
locationManager.requestLocationUpdates(provider, 20000, 1,
(android.location.LocationListener) this);
if (location != null)
onLocationChanged(location);
else
Toast.makeText(getBaseContext(), "Location can't be retrieved",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getBaseContext(), "No Provider Found",
Toast.LENGTH_SHORT).show();
}
TextView txtSugbo = (TextView) findViewById(R.id.txtSugbo);
Typeface typeFace1 = Typeface.createFromAsset(getAssets(),
"fonts/HolyRavioliNF.ttf");
txtSugbo.setTypeface(typeFace1);
TextView txtWays = (TextView) findViewById(R.id.txtWays);
Typeface typeFace2 = Typeface.createFromAsset(getAssets(),
"fonts/Angella_demo.otf");
txtWays.setTypeface(typeFace2);
Button btnGetStarted = (Button) findViewById(R.id.btnGetStarted);
btnGetStarted.setOnClickListener(this);
GoogleMap googleMap;
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
}
public void onClick(View v, Location location) {
switch (v.getId()) {
case R.id.btnGetStarted:
double longitude = location.getLongitude();
double latitude = location.getLatitude();
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q="+latitude+","+longitude+"- Current location."));
startActivity(intent);
break;
}
}
@Override
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
}
}
这是我的 activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="@+id/imgJeep"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:contentDescription="@string/icon_desc"
android:src="@drawable/jeep_new" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="horizontal" >
<TextView
android:id="@+id/txtSugbo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sugbo"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/Orange"
android:textSize="50sp" />
</LinearLayout>
<TextView
android:id="@+id/txtWays"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/ways"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="30sp" />
<Button
android:id="@+id/btnGetStarted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="40dp"
android:text="@string/get_started"
android:onClick="onClick" />
和我的 map fragment xml
package com.VaSuRa.sugboways;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class MapFragmentActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
Intent i = getIntent();
}
}
最后是我的 activity_map.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:tools="http://schemas.android.com/tools">
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:layout="@layout/activity_main" />
我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-
我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在
我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r
我正在查看instance_variable_set的文档并看到给出的示例代码是这样做的:obj.instance_variable_set(:@instnc_var,"valuefortheinstancevariable")然后允许您在类的任何实例方法中以@instnc_var的形式访问该变量。我想知道为什么在@instnc_var之前需要一个冒号:。冒号有什么作用? 最佳答案 我的第一直觉是告诉你不要使用instance_variable_set除非你真的知道你用它做什么。它本质上是一种元编程工具或绕过实例变量可见性的黑客攻击
在我的应用程序中,我需要能够找到所有数字子字符串,然后扫描每个子字符串,找到第一个匹配范围(例如5到15之间)的子字符串,并将该实例替换为另一个字符串“X”。我的测试字符串s="1foo100bar10gee1"我的初始模式是1个或多个数字的任何字符串,例如,re=Regexp.new(/\d+/)matches=s.scan(re)给出["1","100","10","1"]如果我想用“X”替换第N个匹配项,并且只替换第N个匹配项,我该怎么做?例如,如果我想替换第三个匹配项“10”(匹配项[2]),我不能只说s[matches[2]]="X"因为它做了两次替换“1fooX0barXg
我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e
我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳
我真的很习惯使用Ruby编写以下代码:my_hash={}my_hash['test']=1Java中对应的数据结构是什么? 最佳答案 HashMapmap=newHashMap();map.put("test",1);我假设? 关于java-等价于Java中的RubyHash,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/22737685/
我在pry中定义了一个函数:to_s,但我无法调用它。这个方法去哪里了,怎么调用?pry(main)>defto_spry(main)*'hello'pry(main)*endpry(main)>to_s=>"main"我的ruby版本是2.1.2看了一些答案和搜索后,我认为我得到了正确的答案:这个方法用在什么地方?在irb或pry中定义方法时,会转到Object.instance_methods[1]pry(main)>defto_s[1]pry(main)*'hello'[1]pry(main)*end=>:to_s[2]pry(main)>defhello[2]pry(main)
我使用的是Firefox版本36.0.1和Selenium-Webdrivergem版本2.45.0。我能够创建Firefox实例,但无法使用脚本继续进行进一步的操作无法在60秒内获得稳定的Firefox连接(127.0.0.1:7055)错误。有人能帮帮我吗? 最佳答案 我遇到了同样的问题。降级到firefoxv33后一切正常。您可以找到旧版本here 关于ruby-无法在60秒内获得稳定的Firefox连接(127.0.0.1:7055),我们在StackOverflow上找到一个类