i want to make my own app, and i just very simply want to start it up. but for some reason i cant make it work on my emulator. I have no error messages so i don't know what is wrong :S Sorry im a novic in programming and i could not find anything that would help me. Thanks !
here are my codes:
xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="#+id/BBG"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Big Bang Theory" />
<Button
android:id="#+id/HIMYM"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="How I Met Your Mother" />
</LinearLayout>
android manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.watchserie"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Menu"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
menu java file:
package watchserie.niels;
import com.example.watchserie.R;
import android.app.Activity;
import android.os.Bundle;
public class Menu extends Activity {
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.menu);
}
}
Your package names don't match. You Java file is in the watchserie.niels package, while your manifest uses com.example.watchserie. As you're using a dot before the Activity name, it instructs that the package name be automatically added to it. Due to this, you're telling Android that your Activity is: com.example.watchserie.Menu, while in reality it is watchserie.niels.Menu
To fix it, change:
package="com.example.watchserie"
to
package="watchserie.niels"
And remove the following line from your Java file:
import com.example.watchserie.R;
EDIT You could change it the other way around too, but Google Play (and other app stores too I guess) will not allow you to upload any app using the com.example.* namespace. Because of this, I suggested you choose the package without com.example in it.
Related
I've edited and added features from a programme which has involved adding another class (not activity class) since then when I load the app onto my android device I cannot see an icon appear but the app appears in the Application Manager. I have no errors showing and have commented out each section of the new class to turn it back to the original app. Could anyone tell me whether the problem is most likely to be in the manifest, the main.xml or the activity class? Or if they have come across a similar problem?
Cannot publish code due to company policy.
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myAppName" <!-- real package name cannot be supplied -->
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAINACTIVITY" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="com.example.MyAppName.ProviderClassName"
android:authorities="com.example.MyAppName.ProviderClassName"
/>
</application>
</manifest>
i am trying out an android map application, when i run it there are no errors or problems in the code, i use my samsung galaxy s3 to test it but it keeps on displaying >"Unfortunately, maps has stopped".
Here's my java file
package com.maps;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;
public class Main extends MapActivity {
MapView map;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
map = (MapView) findViewById(R.id.mvMain);
}
#Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
Here is my xml code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="AIzaSyAfv657yXaBMlBLAe2pw0VyJiPLiczDG7E"
android:id="#+id/mvMain"/>
</LinearLayout>
Here is my manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-library android:name="com.google.android.maps"/>
<activity
android:name="com.maps.Main"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
A crash when using maps is often due to a bad API key. Double check that the key you are using is valid
Try to use Google Maps v2 for Android.
Here you have a good tutorial.
Anyway, your problem seems to be with the API key.
If GOOGLE API is not valid it will not show map that's it .
Why don't you attach your manifest.xml file so that we can rectify your error.
Otherwise check manifest file whether it contains reference of GOOGLEapi or not.
Android google maps get error Couldn't get connection factory client, I have get apikey from here, this is my code:
MainActivity.java
package com.haichal.map;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;
public class MainActivity extends MapActivity
{
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
#Override
protected boolean isRouteDisplayed() {
return false;
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0IbdGeqd17e6zbTdNfSze2pEt1jJzEEPoOM0jZw"
/>
</RelativeLayout>
Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.haichal.map"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name=".MainActivity"
android:label="#string/title_app" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
And in android project target, I using Google Apis, platform 4.1.2, Api level 16.
In my eclipse project no get error(no red ballon), I debug and install success, but when I run apps, maps just get blank grid, not get maps, if I look in log cat I get message error Couldn't get connection factory client.
How to solved my problem?
when i run apps, maps just get blank grid, not get maps
Either your device does not have Internet access (at least to the Google Maps server), or your API key is wrong. Another possibility would be that you lack the INTERNET permission, but it appears that you have that already.
if i look in log cat i get message error Couldn't get connection factory client
That message happens all of the time, even when your app works.
can anyone provide me a sample for integrating adwhril into android.I tried this sample
http://paste2.org/p/2168910
I used the same code as that one replacing the sdk key of mine But i am getting warnings saying
Can anyone suggest me
updated the code as suggested and got this warning
Yea, i have also faced this problem and solved in this way
Add those if you didn't already added in your menifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
In your activity where you want to show the add
<meta-data android:value="---- Your Key ----"
android:name="ADWHIRL_KEY"/>
Now add all the jar of the add provider you used, in your ad-whirl network. Add them to your app's libs folder and then add them to build path by right clicking on them from libs.
For example if you use Admob then add admob's jar to libs and add it to build path. And then add this line to menifest as this is needed to show add from admob individually or by using adwhirl
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" >
</activity>
Now you will see the adds of admob.
Thank you
Ps: i have added the full code with image
Menifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.expadwhirl"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:value="2f120f401e9a40d0afa55557d3a3a58c"
android:name="ADWHIRL_KEY"/>
</activity>
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" >
</activity>
</application>
</manifest>
Layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.adwhirl.AdWhirlLayout
android:id="#+id/adwrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
/>
</RelativeLayout>
Activity
import android.app.Activity;
import android.os.Bundle;
import com.adwhirl.AdWhirlLayout;
import com.adwhirl.AdWhirlLayout.AdWhirlInterface;
public class MainActivity extends Activity implements AdWhirlInterface {
AdWhirlLayout adwrl;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
public void adWhirlGeneric() {
// TODO Auto-generated method stub
}
}
Overall project
I am trying to develop a simple app using Google maps.
While running the app i can see only the grid and the map controls.
I did obtain an API key and included it into main.xml file.
The permissions for the internet was also granted in the androidmanifest.xml.
My browser in avd is connecting to internet and when i run the native map app in the avd, it shows the following error.
**Network Failure ... Wrong remote strings version.GMM Server must be hosting:/strings_remote_533149424.dat**
GoogleMapActivity.java
package com.example.googlemap;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
public class GoogleMapActivity extends MapActivity
{
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
}
#Override
protected boolean isRouteDisplayed()
{
return false;
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="0kuSQz9hsxal-_JpKGJbFp__zLqhl5d4gG3ohDg"
/>
manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googlemap"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".GoogleMapActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
</application>
</manifest>
I'm using a proxy to connect to the internet.
Can anyone plz help me out with this..plz help me!!
As far as I know about GoogleMaps, there are no indications in manuals if the proxy could matter in displaying maps. If you got the map controls and the GoogleMap grid, this means that you have been connected to the map server but map tiles permissions were denied to you. What to do:
1. Check it if you got the DEBUG key or the Release key
2. Use the Debug key if you are testing locally with the "apk" downloaded from your PC
3. Use the Release key if you are debugging your "apk" downloaded from the Android market
It looks like you are stumbling upon one of the upper bottle-necks.
If these indications did not work, show your settings and source code on this forum for others to react appropriately.
Did you set this permision in manifest: android.permission.ACCESS_FINE_LOCATION, android.permission.ACCESS_COARSE_LOCATION and in aplication ???
I revisited your question and found 2 possible flaws.
Rewrite your manifest file as follows. USES-PERMISSION tags should be out of the APPLICATION tags.
Possibly, you may have been using a wrong debug-key. Please, generate an new debug-key according to manuals to use with this application on development PC.
If the problem persists, please update your development environment to the latest and test again.
Your rewritten manifest.xml should look like the following:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googlemap"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application android:icon="#drawable/icon" android:label="#string/app_name">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".GoogleMapActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>