2016-10-31 10 views
0

置く必要があります。 ZXing.Net.MobileをマイXamarin.Formsアプリ https://components.xamarin.com/gettingstarted/zxing.net.mobile.formsどこで私が使用しようとしています「アセンブリ」属性

namespace MnakabAlshabaViewBook.Droid 
{ 
    [Activity (Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 
    [assembly: UsesPermission(Manifest.Permission.Flashlight)] 
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity 
    { 

     protected override void OnCreate (Bundle bundle) 
     { 
      base.OnCreate (bundle); 

      global::Xamarin.Forms.Forms.Init (this, bundle); 

      ZXing.Net.Mobile.Forms.Android.Platform.Init(); 

      LoadApplication(new App()); 

     } 

上のフォームのを、私は次のエラーを取得する:

'assembly' is not a valid attribute location for this declarations.Valid attribute locations for this declaration are 'type'. all attributes in this block will be ignored .

どこに置く必要がありますか: [assembly: UsesPermission (Android.Manifest.Permission.Flashlight)] ???

答えて

3

あなたは、名前空間の上にアセンブリ属性を入れて持っているので、このようにそれを並べ替える:

[assembly: UsesPermission(Manifest.Permission.Flashlight)] 
namespace MnakabAlshabaViewBook.Droid 
{ 
    [Activity (Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity 
    { 
     //... Rest of code is here ... 
関連する問題